Given a binary sorted matrix A of size N x N.
Find the row with the maximum number of 1.
Note:
If two rows have the maximum number of 1 then return the row which has a lower index.
Rows are numbered from top to bottom and columns are numbered from left to right.
Assume 0-based indexing.
Input Format
The only argument given is the integer matrix A.
Output Format
Return the row with the maximum number of 1.
Constraints
1 <= N <= 1000
0 <= A[i] <= 1
1 <= B <= 1000
For Example
Input 1:
A = [ [0, 1, 1]
[0, 0, 1]
[0, 1, 1] ]
Output 1:
0
Explanation 1:
Row 0 has maximum number of 1s.
Input 2:
A = [ [0, 0, 0, 0]
[0, 1, 1, 1] ]
Output 2:
1
Explanation 2:
Row 1 has maximum number of 1s.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.