https://leetcode.cn/problems/zero-matrix-lcci/
标记数组
新建布尔数组标记下零元素的位置。
public static void setZeroes(int[][] matrix) {boolean[] col = new boolean[matrix.length]; //行boolean[] row = new boolean[matrix[0].length]; //列for (int i = 0; i < matrix.length; i++) {for (int j = 0; j < matrix[0].length; j++) {if (matrix[i][j] == 0) {col[i] = true;row[j] = true;}}}for (int i = 0; i < matrix.length; i++) {for (int j = 0; j < matrix[0].length; j++) {if (col[i] || row[j]) {matrix[i][j] = 0;}}}}
