Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in the grid.
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] is 0 or 1Solutions for this problem are being prepared.
Try solving it yourselfLARGEST RECTANGLE IN HISTOGRAM - Leetcode 84 - Python • NeetCode • 287,868 views views
Watch 9 more video solutions →Practice Largest 1-Bordered Square with our built-in code editor and test cases.
Practice on FleetCode