Description

You are given a 2D array accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth of the richest customer (sum of all their accounts).

Examples

Input:accounts = [[1,2,3],[3,2,1]]
Output:6
Explanation:

Both customers have wealth 6.

Input:[[10]]
Output:10
Explanation:

Single customer with one account containing 10 units. The maximum wealth is 10.

Input:[[4,6,2,8],[1,9,5,3],[7,2,4,1]]
Output:20
Explanation:

Customer 1 has wealth 4+6+2+8=20, Customer 2 has wealth 1+9+5+3=18, Customer 3 has wealth 7+2+4+1=14. The richest customer has wealth 20.

Constraints

  • 1 ≤ m, n ≤ 50

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!