1class Solution:2def setZeroes(self, matrix: List[List[int]]) -> None:3rows = len(matrix)4cols = len(matrix[0])5visited = set()6for r in range(rows):7for c in range(cols):89if matrix[r][c] == 0 and (r, c) not in visited:10for t in range(cols):11if matrix[r][t] != 0:12matrix[r][t] = 013visited.add((r, t))14for h in range(rows):15if matrix[h][c] != 0:16matrix[h][c] = 017visited.add((h, c))