Set Matrix Zeroes

Given an m x n integer matrix, if an element is 0, set its entire row and column to 0's. This must be done in place.

Constraints

  • m == matrix.length
  • n == matrix[0].length
  • 1 <= m, n <= 200
  • -2^31 <= matrix[i][j] <= 2^31 - 1
Saving… · 2 lines
class Solution:
def setMatrixZeroes(self, matrix: List[List[int]]) -> None:
Console

Click Run to execute sample tests.