Back to Browse

Solving Leetcode 73. Set Matrix Zeros in Python using extra memory

44 views
Aug 23, 2022
3:00

Hey This video shows the python code to the problem Leetcode 73. Set Matrix Zeros Python Code: def setZeroes(self, matrix): r=len(matrix) c=len(matrix[0]) rows, cols=set(), set() for i in range(r): for j in range(c): if matrix[i][j]==0: rows.add(i) cols.add(j) for i in range(r): for j in range(c): if i in rows or j in cols: matrix[i][j]=0 Java code: https://leetcode.com/problems/set-matrix-zeroes/solution/ Follow me on insta: https://www.instagram.com/code_philic/ Thank you all

Download

0 formats

No download links available.

Solving Leetcode 73. Set Matrix Zeros in Python using extra memory | NatokHD