Given n*n spaced integers of a 2-d Array.Task is to set every value in the matrix to 0 if that row or columns contains a 0.
Input:
First line of input file contains an integer T, denoting the number of test cases. Then T test case follow. First line of each test case contains a integer n.Next line contains n*n spaced integers.
Output:
For each test case, Print the final matrix formed after performing the required task.
Constraints:
1<=T<=110
1<=n<=100
0<=a[i][j]<=1000
Example:
Input:
1
3
1 2 3 4 0 5 0 6 7
Output:
0 0 3 0 0 0 0 0 0
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
codersanjeev | 66 |
snow_den_ | 60 |
BoggavarapuRamSaranSaiSrinivasGupta | 60 |
rajupraaa1234 | 53 |
SUZAKU | 49 |
mr_kksparrow | 433 |
manvirag982 | 258 |
snow_den_ | 232 |
arpit_anshuman | 228 |
SoumyaKaushik | 205 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |