Class Solution
-
- All Implemented Interfaces:
public final class Solution
1139 - Largest 1-Bordered Square.
Medium
Given a 2D
grid
of0
s and1
s, return the number of elements in the largest square subgrid that has all1
s on its border , or0
if such a subgrid doesn't exist in thegrid
.Example 1:
Input: grid = \[\[1,1,1],1,0,1,1,1,1]
Output: 9
Example 2:
Input: grid = \[\[1,1,0,0]]
Output: 1
Constraints:
1 <= grid.length <= 100
1 <= grid[0].length <= 100
grid[i][j]
is0
or1
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final Integer
largest1BorderedSquare(Array<IntArray> grid)
-
-
Method Detail
-
largest1BorderedSquare
final Integer largest1BorderedSquare(Array<IntArray> grid)
-
-
-
-