Example 1

Example 2

1 <= grid.length, grid[i].length <= 30grid[i][j] is either 0 or 1.The input is generated such that there are at least three 1's in grid.Example 1

Example 2

1 <= grid.length, grid[i].length <= 30grid[i][j] is either 0 or 1.The input is generated such that there are at least three 1's in grid.