(String[] args)
| 5 | // this code will set all elements in the respective rows and columns in matrix to zero, in which a zero is located in matrix. |
| 6 | public class SetZeroes { |
| 7 | public static void main(String[] args) { |
| 8 | int[][] mat = { |
| 9 | {1, 3, 5}, |
| 10 | {2, 0, 8}, |
| 11 | {4, 4, 6} |
| 12 | }; |
| 13 | |
| 14 | setZeroes(mat); |
| 15 | print2D(mat); |
| 16 | } |
| 17 | |
| 18 | static void setZeroes(int[][] matrix) { |
| 19 | boolean firstrow = false; |