73. Set Matrix Zeroes
Practice Set Matrix Zeroes for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Wherever matrix contains a 0, set that cell's entire row and entire column to 0. Do it in place and return nothing. Only zeros that were in the original matrix count. Try for O(1) extra space.
Example
matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] -> [[0,0,0,0],[0,4,5,0],[0,3,1,0]]
Constraints
- 1 <= m, n <= 200 (m rows, n columns)
- -2^31 <= matrix[i][j] <= 2^31 - 1