classSolution(object):defsetZeroes(self,matrix):""" :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """iflen(matrix)==0:returnrownum=len(matrix)colnum=len(matrix[0])row=[Falseforiinrange(rownum)]# false * rownumcol=[Falseforiinrange(colnum)]# false * colnumforiinrange(rownum):forjinrange(colnum):ifmatrix[i][j]==0:# set true to the corresponding row, col position.row[i]=Truecol[j]=Trueforiinrange(rownum):forjinrange(colnum):ifrow[i]orcol[j]:matrix[i][j]=0if__name__=="__main__":answer=Solution()printanswer.setZeroes([[0,0,0,5],[4,3,1,4],[0,1,1,4],[1,2,1,3],[0,0,1,1]])