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

30:00

Set Matrix Zeroes
medium
Topics
Companies

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

Example 1:
Input: [[1,1,1],[1,0,1],[1,1,1]]
Output: [[1,0,1],[0,0,0],[1,0,1]]
Constraints:
  • m==matrix.lengthm == \text{matrix.length}

  • n==matrix[0].lengthn == \text{matrix}[0].\text{length}

  • 1m,n2001 \leq m, n \leq 200

  • 231matrix[i][j]2311-2^{31} \leq \text{matrix}[i][j] \leq 2^{31} - 1

Input
arr =[[1,1,1],[1,0,1],[1,1,1]]

Start

1

1

1

1

0

1

1

1

1

Variables
No variables to display
DepthFunction Call
Stack empty
0/18