# Leetcode 73. Set Matrix Zeros ## 題解 ```python= class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ # Brute force # Time complexity: O(m*n) # Space complexity: O(m*n) m,n = len(matrix),len(matrix[0]) zeros = [] for node in range(m*n): y,x = node % m, node // m if matrix[y][x] == 0: zeros.append(node) for node in zeros: y,x = node % m, node // m for _x in range(n): matrix[y][_x] = 0 for _y in range(m): matrix[_y][x] = 0 ```