Menu
CoddyTech

Richest Customer Wealth

A bank keeps a grid accounts with m rows, one per customer, and n columns, one per bank: accounts[i][j] is the money customer i holds in bank j. A customer's wealth is the total of their row. Return the wealth of the richest customer.

Function

maximumWealth(accounts: integer-2d-array) → integer
accountsinteger-2d-array
the grid of balances, one row per customer and one column per bank
Returnsinteger
the largest row total

Constraints

  • 1 ≤ accounts.length ≤ 100
  • 1 ≤ accounts[i].length ≤ 100, and every row has the same length.
  • 0 ≤ accounts[i][j] ≤ 104

Examples

Input
accounts = [[2, 8, 1], [5, 5, 4], [7, 0, 3]]
Output
14
Explanation
The rows sum to 11, 14 and 10. The middle customer is the richest with 14, even though the largest single balance, 8, belongs to someone else.
Reset code
def maximumWealth(accounts):
    # Write code here

Test #1

Test #2

Argument

accounts = [[2, 8, 1], [5, 5, 4], [7, 0, 3]]

Expected Output

14