Set Matrix Zeros

Try to solve the Set Matrix Zeros problem.


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


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


Create a free account to view this lesson.

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