You are given a matrix ‘ARR’ with dimensions ‘N’ * ‘M’ and containing only 0s and 1s where each row is sorted.
Your task is to find the index of the row with a maximum number of 1s in it. Rows and columns are 0-indexed based.
Input format:
The first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains two space-separated integers, ‘N’ and ‘M’, denoting the number of rows and the number of columns respectively.
Then each of the next N lines contains M elements.
Output format:
For each test case, return the index of the row, which has the maximum number of 1’s in it. If more than one row has the same number of 1’s, then return the row with the lowest index(consider 0-based indexing).
Output for each test case is printed on a separate line.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 1000
1 <= N, M <= 500
Time Limit: 1 sec