mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 15:01:40 +08:00
国外版
This commit is contained in:
25
算法题(国外版)/largest-1-bordered-square.html
Normal file
25
算法题(国外版)/largest-1-bordered-square.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<p>Given a 2D <code>grid</code> of <code>0</code>s and <code>1</code>s, return the number of elements in the largest <strong>square</strong> subgrid that has all <code>1</code>s on its <strong>border</strong>, or <code>0</code> if such a subgrid doesn't exist in the <code>grid</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> grid = [[1,1,1],[1,0,1],[1,1,1]]
|
||||
<strong>Output:</strong> 9
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> grid = [[1,1,0,0]]
|
||||
<strong>Output:</strong> 1
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= grid.length <= 100</code></li>
|
||||
<li><code>1 <= grid[0].length <= 100</code></li>
|
||||
<li><code>grid[i][j]</code> is <code>0</code> or <code>1</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user