-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path73.txt
More file actions
29 lines (25 loc) · 808 Bytes
/
73.txt
File metadata and controls
29 lines (25 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Solution {
public:
void setZeroes(vector<vector<int>>& mat) {
for(int i=0;i<mat.size();i++){
for(int j=0;j<mat[0].size();j++){
if(mat[i][j]==0){
mat[i][j]=-1000;
for(int r=0;r<mat.size();r++){
if(mat[r][j]==0)continue;
mat[r][j]=-1000;
}
for(int c=0;c<mat[0].size();c++){
if(mat[i][c]==0)continue;
mat[i][c]=-1000;
}
}
}
}
for(int i=0;i<mat.size();i++){
for(int j=0;j<mat[0].size();j++){
if(mat[i][j]==-1000)mat[i][j]=0;
}
}
}
};