Completely Passable Grid Rows and Columns
Updated
Problem statement
A rectangular board contains 0 for a passable cell and + for an obstacle. Return the rows and columns that are completely passable: every cell in each returned row or column must be 0.
For this exercise, assume grid contains one string per row. Return exactly two integer arrays: first the row indices, then the column indices. Indices are zero-based and each array is in increasing order. Either array may be empty.
Function
passableLines(grid: String[]) → int[][]Examples
Example 1
grid = ["000","+00","000"]return = [[0,2],[1,2]]Rows 0 and 2 and columns 1 and 2 contain only zeroes.
Example 2
grid = ["0+","+0"]return = [[],[]]Every row and column contains an obstacle.
Example 3
grid = ["0"]return = [[0],[0]]The single passable cell makes both its row and column completely passable.
Constraints
- For this exercise, assume
1 <= grid.length <= 30and each row has the same length from1through30. - Every cell is
0or+.
More Walmart Phone Screen questions
- Count Months Starting on SundayPHONE SCREEN · Seen Aug 2026
- Longest Even-Length WordPHONE SCREEN · Seen Aug 2026
- Range ModulePHONE SCREEN · Seen Aug 2026
- Meeting Rooms IIPHONE SCREEN · Seen Aug 2026
- Sort Real Number StringsPHONE SCREEN · Seen Jan 2026
- Check a Password Against a Supplied PolicyPHONE SCREEN · Seen Jun 2025
- Convert a Restricted Function to an Arrow FunctionPHONE SCREEN · Seen Jun 2025
- Repair One Missing Function Punctuation CharacterPHONE SCREEN · Seen Jun 2025
- Can the Singer Perform the Song?PHONE SCREEN · Seen Mar 2025
- Rooms With Two Other Entrances and a Treasure SuccessorPHONE SCREEN · Seen Mar 2025
Similar questions at other companies
- Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
- One-Nearest-Neighbor Classification with Manhattan DistanceOpenAI · PHONE SCREENOpenAI interview questions
- Unique Pairs in a 2D Matrix Summing to TargetAmazon · PHONE SCREEN
- Map Black Cells to Covering 2x2 BlocksSquare · PHONE SCREEN
- Trace an Eight-Direction Robot Until BlockedPinterest · PHONE SCREENPinterest interview questions
- Excel Training Data and Model Response AuditMicrosoft · PHONE SCREENMicrosoft interview questions
- Count Connect-Four Scoring LinesBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Target Cells in One Block per Row and ColumnWhatNot · PHONE SCREENWhatNot interview questions
- Completely Passable Grid LinesSplunk · PHONE SCREENSplunk interview questions
- Mark a Queen’s Attack BoardMotive · PHONE SCREENMotive interview questions