Skip to content

Commit e013e23

Browse files
authored
Merge pull request #90 from InflixOP/patch1
Create #2352. Equal Row and Column Pairs.cpp
2 parents 2b3c05c + 07b401d commit e013e23

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

#2352. Equal Row and Column Pairs.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public:
3+
int equalPairs(vector<vector<int>>& grid) {
4+
int n=grid.size();
5+
int c=0;
6+
map<vector<int>,int> mp;
7+
for(int i=0;i<n;i++){
8+
mp[grid[i]]++;
9+
}
10+
for(int i=0;i<n;i++){
11+
vector<int> col;
12+
for(int j=0;j<n;j++){
13+
col.push_back(grid[j][i]);
14+
}
15+
c+=mp[col];
16+
}
17+
return c;
18+
}
19+
};

0 commit comments

Comments
 (0)