Question
Wealth of the Richest Customer

You are given a 2D integer matrix accounts of size n × m, where accounts[i][j] represents the amount of money the i-th customer has in the j-th bank.

The wealth of a customer is defined as the sum of money across all their bank accounts.

Your task is to determine the maximum wealth among all customers and return that value.

Input
The first line of input contains two space-separated integer n and m.
Each of the following n lines contains m space-separated integers, representing the elements of the grid accounts.
Output
Print an integer, representing the wealth that the richest customer has.
Example
Input
2 3
1 2 3
3 2 1
Output
6
Explanation
1st customer has wealth = 1 + 2 + 3 = 6
2nd customer has wealth = 3 + 2 + 1 = 6
Both customers are considered the richest with a wealth of 6 each, so print 6.

Input
3 2
1 5
7 3
3 5
Output
10
Explanation
1st customer has wealth = 1 + 5 = 6
2nd customer has wealth = 7 + 3 = 10
3rd customer has wealth = 3 + 5 = 8
The 2nd customer is the richest with a wealth of 10, so print 10.

Online