Description
Solutions
Submission
Prison Break 🪴
🔥 FULLTIME

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

Example 1:

Input:  n = 6, m = 6, h = [4], v = [2]
Output: 4
Explanation:
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:
    Unknown for now 🦜
Thumbnail 0
Testcase

Result
Case 1

input:

output: