FastPrepFastPrep
Problem Brief

Prison Break 🪴

FULLTIMEOA

A prisoner is planning to escape from prison! The prison's gate consists of horizontal and vertical bars that are spaced one unit apart, so the area of each hole between the bars is 1 x 1. The prisoner manages to remove certain bars to make some bigger holes. Determine the area of the largest hole in the gate after the bars are removed.

Function Description

Complete the function prison in the editor below.

prison has the following parameter(s):

  1. n: an integer, the number of horizontal bars
  2. m: an integer, the number of vertical bars
  3. int h[]: an array of integers, the horizontal bars to remove
  4. int v[]: an array of integers, the vertical bars to remove

Returns

int: the area of the largest hole in the gate after the bars are removed

1Example 1

Input
n = 6, m = 6, h = [4], v = [2]
Output
4
Explanation
Example 1 illustration
In the images below, the left image depicts the initial prison gate with n = 6 horizontal and m = 6 vertical bars. The area of the biggest hole in the bars is 1 x 1. The right image depicts that same gate after the prisoner removes horizontal bar 4 and vertical bar 2, at which point the area of the biggest hole in the bars becomes 2 x 2 = 4.

Constraints

Limits and guarantees your solution can rely on.

Unknown for now 🦜
public int prison(int n, int m, int[] h, int[] v) {
    // write your code here
}
Input

n

6

m

6

h

[4]

v

[2]

Output

4

Sign in to submit your solution.