We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bba4a94 commit aedf76fCopy full SHA for aedf76f
set-matrix-zeroes/hu6r1s.py
@@ -0,0 +1,16 @@
1
+class Solution:
2
+ def setZeroes(self, matrix: List[List[int]]) -> None:
3
+ """
4
+ Do not return anything, modify matrix in-place instead.
5
6
+ zero = []
7
+ for i in range(len(matrix)):
8
+ for j in range(len(matrix[0])):
9
+ if matrix[i][j] == 0:
10
+ zero.append((i, j))
11
+
12
+ for x, y in zero:
13
+ for i in range(len(matrix[0])):
14
+ matrix[x][i] = 0
15
16
+ matrix[i][y] = 0
0 commit comments