65. Row With the Largest Sum
Core1000 ms256 MBSolved by 0%
Print the 0-based index of the row whose values add up to the largest total.
If two rows tie, print the smaller index.
Constraints - `1 ≤ r, c ≤ 100` - `-1000000 ≤ each value ≤ 1000000`
Input
The first line contains two integers r and c.
Each of the next r lines contains c space-separated integers.
Output
Print one integer — the 0-based index of the row with the largest total. On a tie, print the smaller index.
Input3 3
1 2 3
9 9 9
4 5 6
Output1
Notehas the largest row in the middle
Input2 2
5 5
5 5
Output0
Notehas two tied rows, so the smaller index wins
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution