Practice Find the Minimum Area to Cover All Ones II
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. You need to find 3 non-overlapping rectangles having non-zero areas with horizontal and vertical sides such that all the 1's in grid lie inside these rectangles. Return the minimum possible sum of the area of these rectangles. Note that the rectangles are allowed to touch.
Source: Find the Minimum Area to Cover All Ones II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
grid = [[1,0,1],[1,1,1]]
5
# Example 2
grid = [[1,0,1,0],[0,1,0,1]]
5
Constraints
Related LeetCode Problems
Practice more problems similar to Find the Minimum Area to Cover All Ones II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.