Set Matrix Zeroes

Try to solve the Set Matrix Zeroes problem.

Statement

Given a matrix, mat, if any element within the matrix is zero, set that row and column to zero.

Constraints:

  • 11 \le mat.row, mat.col 20\le 20
  • 231-2^{31} \le mat[i][j] 2311\le 2^{31} - 1

Examples

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy