Richest Customer Wealth

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i^th customer has in the j^th bank. Return the wealth that the richest customer has.

A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth.

Example 1
Inputaccounts = [[1,2,3],[3,2,1]]
Output6
Both customers have wealth 6, so both are considered the richest and the answer is 6.
Example 2
Inputaccounts = [[1,5],[7,3],[3,5]]
Output10
The customers have wealths 6, 10, and 8 respectively, so the 2nd customer is the richest with wealth 10.

Constraints

  • m == accounts.length
  • n == accounts[i].length
  • 1 <= m, n <= 50
  • 1 <= accounts[i][j] <= 100

Asked at 5 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate