Skip to content

Commit db637a3

Browse files
committed
Create README - LeetHub
1 parent f8c20fd commit db637a3

File tree

1 file changed

+51
-0
lines changed
  • 3459-find-the-minimum-area-to-cover-all-ones-ii

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<h2><a href="https://leetcode.com/problems/find-the-minimum-area-to-cover-all-ones-ii">3459. Find the Minimum Area to Cover All Ones II</a></h2><h3>Hard</h3><hr><p>You are given a 2D <strong>binary</strong> array <code>grid</code>. You need to find 3 <strong>non-overlapping</strong> rectangles having <strong>non-zero</strong> areas with horizontal and vertical sides such that all the 1&#39;s in <code>grid</code> lie inside these rectangles.</p>
2+
3+
<p>Return the <strong>minimum</strong> possible sum of the area of these rectangles.</p>
4+
5+
<p><strong>Note</strong> that the rectangles are allowed to touch.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<div class="example-block">
11+
<p><strong>Input:</strong> <span class="example-io">grid = [[1,0,1],[1,1,1]]</span></p>
12+
13+
<p><strong>Output:</strong> <span class="example-io">5</span></p>
14+
15+
<p><strong>Explanation:</strong></p>
16+
17+
<p><img alt="" src="https://assets.leetcode.com/uploads/2024/05/14/example0rect21.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 280px; height: 198px;" /></p>
18+
19+
<ul>
20+
<li>The 1&#39;s at <code>(0, 0)</code> and <code>(1, 0)</code> are covered by a rectangle of area 2.</li>
21+
<li>The 1&#39;s at <code>(0, 2)</code> and <code>(1, 2)</code> are covered by a rectangle of area 2.</li>
22+
<li>The 1 at <code>(1, 1)</code> is covered by a rectangle of area 1.</li>
23+
</ul>
24+
</div>
25+
26+
<p><strong class="example">Example 2:</strong></p>
27+
28+
<div class="example-block">
29+
<p><strong>Input:</strong> <span class="example-io">grid = [[1,0,1,0],[0,1,0,1]]</span></p>
30+
31+
<p><strong>Output:</strong> <span class="example-io">5</span></p>
32+
33+
<p><strong>Explanation:</strong></p>
34+
35+
<p><img alt="" src="https://assets.leetcode.com/uploads/2024/05/14/example1rect2.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 356px; height: 198px;" /></p>
36+
37+
<ul>
38+
<li>The 1&#39;s at <code>(0, 0)</code> and <code>(0, 2)</code> are covered by a rectangle of area 3.</li>
39+
<li>The 1 at <code>(1, 1)</code> is covered by a rectangle of area 1.</li>
40+
<li>The 1 at <code>(1, 3)</code> is covered by a rectangle of area 1.</li>
41+
</ul>
42+
</div>
43+
44+
<p>&nbsp;</p>
45+
<p><strong>Constraints:</strong></p>
46+
47+
<ul>
48+
<li><code>1 &lt;= grid.length, grid[i].length &lt;= 30</code></li>
49+
<li><code>grid[i][j]</code> is either 0 or 1.</li>
50+
<li>The input is generated such that there are at least three 1&#39;s in <code>grid</code>.</li>
51+
</ul>

0 commit comments

Comments
 (0)