Problem · Array
Completely Passable Grid Lines
Learn this problemProblem statement
You are given a non-empty rectangular grid of characters. A 0 is passable and a + is impassable.
Return a two-element list. Its first list contains, in increasing order, every zero-based row index whose cells are all passable. Its second list contains, in increasing order, every zero-based column index whose cells are all passable.
Function
passableLines(grid: String[]) → List<List<Integer>>Examples
Example 1
grid = ["000","0+0","000"]return = [[0,2],[0,2]]Rows 0 and 2 and columns 0 and 2 contain only passable cells.
Example 2
grid = ["++","++"]return = [[],[]]No row or column is completely passable.
Constraints
1 <= grid.length.1 <= grid[i].length.- Every row has the same length.
- The grid contains at most
4,096cells. - Every cell is
0or+.