
class Solution:
    def setZeroes(self, matrix):
        dummy1=[1]*len(matrix)
        dummy2=[1]*len(matrix[0])

        for i in range(len(matrix)):
            for j in range(len(matrix[0])):
                if matrix[i][j]==0:
                    dummy1[i]=0
                    dummy2[j]=0

        for i in range(len(matrix)):
            for j in range(len(matrix[0])):
                if dummy1[i]==0 or dummy2[j]==0:
                    matrix[i][j]=0

        return matrix


class Solution:
    def setZeroes(self, matrix):
        dummy1=[1]*len(matrix)
        dummy2=[1]*len(matrix[0])

        for i in range(len(matrix)):
            for j in range(len(matrix[0])):
                if matrix[i][j]==0:
                    dummy1[i]=0
                    dummy2[j]=0

        for i in range(len(matrix)):
            for j in range(len(matrix[0])):
                if dummy1[i]==0 or dummy2[j]==0:
                    matrix[i][j]=0

        return matrix
