Header Ads Widget

Reset Matrix | coding ninjas solution

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

Code(Python):-


Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments