Skip to content

Commit b49316a

Browse files
committed
Comment out the my initial approach
1 parent 4699e1d commit b49316a

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

set-matrix-zeroes/Jeehay28.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,30 @@ var setZeroes = function (matrix) {
7777
// 💪 My initial approach with Set...
7878
// Time Complexity: O(m * n)
7979
// Space Complexity: O(m + n)
80-
var setZeroes = function (matrix) {
81-
let rows = new Set();
82-
let cols = new Set();
83-
84-
for (let i = 0; i < matrix.length; i++) {
85-
for (let j = 0; j < matrix[0].length; j++) {
86-
if (matrix[i][j] === 0) {
87-
rows.add(i);
88-
cols.add(j);
89-
}
90-
}
91-
}
92-
93-
for (row of rows) {
94-
matrix[row] = new Array(matrix[0].length).fill(0);
95-
}
96-
97-
for (col of cols) {
98-
for (let row = 0; row < matrix.length; row++) {
99-
matrix[row][col] = 0;
100-
}
101-
}
102-
103-
return matrix;
104-
};
80+
// var setZeroes = function (matrix) {
81+
// let rows = new Set();
82+
// let cols = new Set();
83+
84+
// for (let i = 0; i < matrix.length; i++) {
85+
// for (let j = 0; j < matrix[0].length; j++) {
86+
// if (matrix[i][j] === 0) {
87+
// rows.add(i);
88+
// cols.add(j);
89+
// }
90+
// }
91+
// }
92+
93+
// for (row of rows) {
94+
// matrix[row] = new Array(matrix[0].length).fill(0);
95+
// }
96+
97+
// for (col of cols) {
98+
// for (let row = 0; row < matrix.length; row++) {
99+
// matrix[row][col] = 0;
100+
// }
101+
// }
102+
103+
// return matrix;
104+
// };
105105

106106

0 commit comments

Comments
 (0)