Given an m x n integer matrix, if an element is 0, set its entire row and column to 0's. You must do it in place.
Example 1
Input: matrix = [[1,1,1],[1,0,1],[1,1,1]]
Output: [[1,0,1],[0,0,0],[1,0,1]]
Explanation: The only 0 is at (1,1), so all of row 1 and column 1 become 0. Every other cell keeps its value.
Example 2
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: The 0s are at (0,0) and (0,3). That zeroes all of row 0, and columns 0 and 3 in every row. The inner values 4, 5, 3 and 1 survive.
Example 3
Input: matrix = [[1]]
Output: [[1]]
Explanation: There are no 0s, so the matrix is unchanged.
Use the matrix's own first row and first column as bookmarks: when cell (i,j) is 0, record it by zeroing matrix[i][0] and matrix[0][j]. Two boolean flags remember whether the first row/column themselves need zeroing, so no extra space is used.
Run checks all cases above. Submit evaluates all test cases.