Practice Maximize Area of Square Hole in Grid
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given the two integers, n and m and two integer arrays, hBars and vBars. The grid has n + 2 horizontal and m + 2 vertical bars, creating 1 x 1 unit cells. The bars are indexed starting from 1. You can remove some of the bars in hBars from horizontal bars and some of the bars in vBars from vertical bars. Note that other bars are fixed and cannot be removed. Return an integer denoting the maximum area of a square-shaped hole in the grid, after removing some bars (possibly none).
Source: Maximize Area of Square Hole in Grid on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 2, m = 1, hBars = [2,3], vBars = [2]
4
# Example 2
n = 1, m = 1, hBars = [2], vBars = [2]
4
# Example 3
n = 2, m = 3, hBars = [2,3], vBars = [2,4]
4
Constraints
Related LeetCode Problems
Practice more problems similar to Maximize Area of Square Hole in Grid.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.