1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最大矩形 [maximal-rectangle].html
2022-03-29 12:43:11 +08:00

51 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个仅包含&nbsp;<code>0</code><code>1</code> 、大小为 <code>rows x cols</code> 的二维二进制矩阵,找出只包含 <code>1</code> 的最大矩形,并返回其面积。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/14/maximal.jpg" style="width: 402px; height: 322px;" />
<pre>
<strong>输入:</strong>matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
<strong>输出:</strong>6
<strong>解释:</strong>最大矩形如上图所示。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>matrix = []
<strong>输出:</strong>0
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>matrix = [["0"]]
<strong>输出:</strong>0
</pre>
<p><strong>示例 4</strong></p>
<pre>
<strong>输入:</strong>matrix = [["1"]]
<strong>输出:</strong>1
</pre>
<p><strong>示例 5</strong></p>
<pre>
<strong>输入:</strong>matrix = [["0","0"]]
<strong>输出:</strong>0
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>rows == matrix.length</code></li>
<li><code>cols == matrix[0].length</code></li>
<li><code>1 &lt;= row, cols &lt;= 200</code></li>
<li><code>matrix[i][j]</code><code>'0'</code><code>'1'</code></li>
</ul>