Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    1139 - Largest 1-Bordered Square.

    Medium

    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 <= 100

    • 1 <= grid[0].length <= 100

    • grid[i][j] is 0 or 1

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer largest1BorderedSquare(Array<IntArray> grid)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait