Search⌘ K
AI Features

Solution: Set Matrix Zeroes

Solution: Set Matrix Zeroes asks you to scan a matrix and turn every row and column containing a zero into zeros, modifying the original matrix in place rather than creating a separate one.

Statement

Given a matrix, mat, if any element within the matrix is zero, set that row and column to zero. The performed operations should be in place, i.e., the given matrix is modified directly without allocating another matrix.

Constraints:

  • 1≤1 \le mat.row, mat.col ≤
...