Practice Find the Minimum Area to Cover All Ones I
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 a 2D binary array grid. Find a rectangle with horizontal and vertical sides with the smallest area, such that all the 1's in grid lie inside this rectangle. Return the minimum possible area of the rectangle.
Source: Find the Minimum Area to Cover All Ones I on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
grid = [[0,1,0],[1,0,1]]
Output
6
# Example 2
Input
grid = [[1,0],[0,0]]
Output
1
Constraints
1 <= grid.length, grid[i].length <= 1000
grid[i][j] is either 0 or 1.
The input is generated such that there is at least one 1 in grid.
Related LeetCode Problems
Practice more problems similar to Find the Minimum Area to Cover All Ones I.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.