Skip to content

Commit

Permalink
Create 2643. Row With Maximum Ones.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh-addagatla authored Aug 6, 2024
1 parent 5c8f499 commit c3294e5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 2643. Row With Maximum Ones.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Solution {
public int[] rowAndMaximumOnes(int[][] mat) {
int max=0;
int [] result = new int[2];
for(int i = 0;i<mat.length;i++){
int count=0;
for(int j=0;j<mat[i].length;j++){
if(mat[i][j]==1){
count++;
}
}
if(count>max){
max=count;
result[0]=i;
result[1]=count;
}
}
return result;
}
}

0 comments on commit c3294e5

Please sign in to comment.