Skip to content

Commit 46f0022

Browse files
Create Find Champion I.cpp
1 parent 40a2e2e commit 46f0022

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Find Champion I.cpp

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

0 commit comments

Comments
 (0)