Given an m x n integer matrix, if an element is 0, set its entire row and column to 0s.
You must do it in place.
Before: After: [ 1, 1, 1 ] [ 1, 0, 1 ] [ 1, 0, 1 ] [ 0, 0, 0 ] [ 1, 1, 1 ] [ 1, 0, 1 ]
Input: matrix = [[1,1,1],[1,0,1],[1,1,1]] Output: [[1,0,1],[0,0,0],[1,0,1]] Explanation: The zero at (1,1) zeroes out row 1 and column 1.
Before: After: [ 0, 1, 2, 0 ] [ 0, 0, 0, 0 ] [ 3, 4, 5, 2 ] [ 0, 4, 5, 0 ] [ 1, 3, 1, 5 ] [ 0, 3, 1, 0 ]
Input: matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] Output: [[0,0,0,0],[0,4,5,0],[0,3,1,0]] Explanation: Zeros at (0,0) and (0,3) zero out row 0, column 0, and column 3.
m == matrix.lengthn == matrix[i].length1 <= m, n <= 200-2^31 <= matrix[i][j] <= 2^31 - 13x3 matrix, zero at (1,1)