69. Set Matrix Zeroes

MediumMatrix

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

Examples

Input: [[1,1,1],[1,0,1],[1,1,1]]

Output: [[1,0,1],[0,0,0],[1,0,1]]

Explanation: The single 0 at (1,1) zeroes row 1 and column 1.

Constraints

  • m == matrix.length
  • n == matrix[0].length
  • 1 <= m, n <= 200
  • -2^31 <= matrix[i][j] <= 2^31 - 1
Loading...

Run checks all cases above. Submit evaluates all test cases.