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:
6Explanation:
Both customers have wealth 6.
Input:
[[10]]Output:
10Explanation:
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:
20Explanation:
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