In a spreadsheet-style puzzle, a 0 in any cell wipes out its whole row and its whole column.
Write clearZeros(grid) that changes grid in place: every row and every column that held a 0 in the original grid becomes all zeros. Zeros created by this step don't wipe out anything further.
Input: grid = [[1,2,3],[4,0,6],[7,8,9]] Output: [[1,0,3],[0,0,0],[7,0,9]]
The 0 in the middle clears row 1 and column 1.
Input: grid = [[0,1],[1,1]] Output: [[0,0],[0,1]]
Row 0 and column 0 are cleared; the bottom-right cell stays.
1 <= rows, cols <= 200-2^31 <= grid[r][c] <= 2^31 - 1Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #80 Clear Rows and Columns. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.