Make Columns and Rows Zeros

Given a two-dimensional array, if any element within the array is zero, make its whole row and column zero.

Statement

Given a two-dimensional array, if any element within the array is zero, set its whole row and column zero.

Examples

For example, consider the matrix below:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.