Tap here to switch tabs
Problem
Submissions

Problem: Find the Minimum Area to Cover All Ones II

med
30 min
Try to solve the Find the Minimum Area to Cover All Ones II problem.

Statement

You are given a 2D2 D binary array grid. You need to find 33 non overlapping rectangles with horizontal and vertical sides such that every 11 in grid is covered by at least one rectangle.

Return the minimum possible sum of the areas of these 33 rectangles.

Note: The rectangles cannot overlap with each other, but they may share boundaries.

Constraints:

  • 1≤1 \leq grid.length, grid[i].length ≤30\leq 30

  • grid[i][j] is either 00 or 11.

  • The input is generated such that there are at least 33 occurrences of 11 in grid.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Minimum Area to Cover All Ones II

med
30 min
Try to solve the Find the Minimum Area to Cover All Ones II problem.

Statement

You are given a 2D2 D binary array grid. You need to find 33 non overlapping rectangles with horizontal and vertical sides such that every 11 in grid is covered by at least one rectangle.

Return the minimum possible sum of the areas of these 33 rectangles.

Note: The rectangles cannot overlap with each other, but they may share boundaries.

Constraints:

  • 1≤1 \leq grid.length, grid[i].length ≤30\leq 30

  • grid[i][j] is either 00 or 11.

  • The input is generated such that there are at least 33 occurrences of 11 in grid.