Untitled

 avatar
unknown
plain_text
2 years ago
338 B
7
Indexable
You are given a 2D integer matrix A, make all the elements in a row or column zero if the A[i][j] = 0. Specifically, make entire ith row and jth column zero.


Input - 
[1,2,3,4]
[5,6,7,0]
[9,2,0,4]


Output - 
[1,2,0,0]
[0,0,0,0]
[0,0,0,0]

Explanation - 
A[2][4] = A[3][3] = 0, so make 2nd row, 3rd row, 3rd column and 4th column zero.
Editor is loading...