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)/最大的以 1 为边界的正方形 [largest-1-bordered-square].html
2022-03-29 12:43:11 +08:00

26 lines
829 B
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>给你一个由若干 <code>0</code><code>1</code> 组成的二维网格&nbsp;<code>grid</code>,请你找出边界全部由 <code>1</code> 组成的最大 <strong>正方形</strong> 子网格,并返回该子网格中的元素数量。如果不存在,则返回 <code>0</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>grid = [[1,1,1],[1,0,1],[1,1,1]]
<strong>输出:</strong>9
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>grid = [[1,1,0,0]]
<strong>输出:</strong>1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= grid.length &lt;= 100</code></li>
<li><code>1 &lt;= grid[0].length &lt;= 100</code></li>
<li><code>grid[i][j]</code>&nbsp;<code>0</code>&nbsp;&nbsp;<code>1</code></li>
</ul>