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
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.