Set Matrix Zero problem
Given m x n integer matrix, if an element is 0, then set its entire row and column to 0's, and return the matrix.
- Go through each element in the 2d array
- If the element is zero, then store the column and row in two sets, e.g setRow and setCol
- Iterate the setRow, set the matrix to all zeros in each row from setRow
- Iterate the setCol, set the matrix to all zeros in each column from setCol
See file
$b/java/SetMatrixZero.java