Richest customer
accounts is a table of bank balances stored as a list of lists (a list whose items are themselves lists). Row i belongs to customer i and holds one balance per bank, so accounts[i][j] is what customer i has at bank j. A balance can be negative: that account is overdrawn.
Add up a customer's row and you get their wealth. Return the largest wealth in the table, as an integer. When several customers tie for the top, the answer is still that one number.
accounts = [[4, 1, 2], [3, 3, 3], [5, 0, 1]]Output9The rows add up to 7, 9 and 6. The middle customer is the richest.
accounts = [[2, 8], [7, 3], [1, 4]]Output10The first two customers both have 10. The question asks for the amount, so the tie changes nothing.
accounts = [[-3, 1], [2, -6]]Output-2Both customers are overdrawn: -3 + 1 = -2 and 2 + (-6) = -4. The largest wealth is -2, not 0.
1 ≤ len(accounts) ≤ 2,000 (customers)
1 ≤ len(accounts[i]) ≤ 100 (banks), and every row has the same length
-1,000 ≤ accounts[i][j] ≤ 1,000
Plan it first
Write a line for each before you code, then say them out loud. Compare with the Approach tab afterwards.