Medium
Set rows and columns to zero when a cell is zero.
Modify the matrix in place so that if an element is 0, its entire row and column become 0.
Examples
Input: matrix = [[1,1,1],[1,0,1],[1,1,1]]
Output: [[1,0,1],[0,0,0],[1,0,1]]
Constraints
- Use constant extra space if possible