Skip to content

Commit 151ef34

Browse files
authored
Create 2901. Longest Unequal Adjacent Groups Subsequence II1 (#800)
2 parents e502bf3 + 56d2637 commit 151ef34

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class Solution {
2+
public:
3+
void setZeroes(vector<vector<int>>& matrix) {
4+
vector<int> iV;
5+
vector<int> jV;
6+
int n = matrix.size();
7+
int m = matrix[0].size();
8+
for(int i=0;i<n;i++){
9+
for(int j=0;j<m;j++){
10+
if(matrix[i][j]==0){
11+
iV.push_back(i);
12+
jV.push_back(j);
13+
}
14+
}
15+
}
16+
17+
for(int i=0;i<iV.size();i++){
18+
for(int j=0;j<m;j++){
19+
matrix[iV[i]][j]=0;
20+
}
21+
}
22+
23+
for(int j=0;j<jV.size();j++){
24+
for(int i=0;i<n;i++){
25+
matrix[i][jV[j]]=0;
26+
}
27+
}
28+
}
29+
};

0 commit comments

Comments
 (0)