ByteByteGo: Zero Striping
β’ 55 words β’ 1 min β’ updated
python
from typing import List
def zero_striping(matrix: List[List[int]]) -> None:
row_set = set()
col_set = set()
for x in range(len(matrix)):
for y in range(len(matrix[0])):
c = matrix[x][y]
if c == 0:
row_set.add(x)
col_set.add(y)
for x in range(len(matrix)):
for y in range(len(matrix[0])):
if x in row_set or y in col_set:
matrix[x][y] = 0