# Row with Max Ones

Problem Link: [https://practice.geeksforgeeks.org/problems/maximum-no-of-1s-row3027/1](https://practice.geeksforgeeks.org/problems/maximum-no-of-1s-row3027/1?utm_source=gfg\&utm_medium=article\&utm_campaign=bottom_sticky_on_article)

```python
class Solution:
    def maxOnes (self, matrix, n, m):
        # code here 
        
        # Traversing starts from top-right
        i=0
        j=m-1
        ansrow=-1
        while(i<n and j>=0):
            if(matrix[i][j]==1):
                j-=1
                ansrow=i
            else:
                i+=1
        
        return ans
```
