mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
36 lines
1.1 KiB
HTML
36 lines
1.1 KiB
HTML
<p>在一个由 <code>'0'</code> 和 <code>'1'</code> 组成的二维矩阵内,找到只包含 <code>'1'</code> 的最大正方形,并返回其面积。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/26/max1grid.jpg" style="width: 400px; height: 319px;" />
|
||
<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>4
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/26/max2grid.jpg" style="width: 165px; height: 165px;" />
|
||
<pre>
|
||
<strong>输入:</strong>matrix = [["0","1"],["1","0"]]
|
||
<strong>输出:</strong>1
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>matrix = [["0"]]
|
||
<strong>输出:</strong>0
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>m == matrix.length</code></li>
|
||
<li><code>n == matrix[i].length</code></li>
|
||
<li><code>1 <= m, n <= 300</code></li>
|
||
<li><code>matrix[i][j]</code> 为 <code>'0'</code> 或 <code>'1'</code></li>
|
||
</ul>
|