Class Solution
- java.lang.Object
-
- g1101_1200.s1139_largest_1_bordered_square.Solution
-
public class Solution extends Object
1139 - Largest 1-Bordered Square.Medium
Given a 2D
gridof0s and1s, return the number of elements in the largest square subgrid that has all1s on its border , or0if 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 <= 1001 <= grid[0].length <= 100grid[i][j]is0or1
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intlargest1BorderedSquare(int[][] grid)
-