Reset Matrix

Given an m x n matrix of 0s and 1s, if an element is 0, set its entire row and column to 0. Do it in place.

Note : You don't need to print the matrix. Just change in the given input.

Input format :

Line 1 : No. of rows & No. of columns (separated by space)

Line 2 : Row 1 elements (separated by space)

Line 3 : Row 2 elements (separated by space)

Line 4 : and so on

Sample Input 1 :
3 3
1 0 1
1 1 1 
1 1 1
Sample Output 1 :
0 0 0
1 0 1
1 0 1

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem