Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Richest Customer Wealth

XPChallenge Points: 10
levelLevel: Easy

You are given a 2D grid accounts of size m x n, where accounts[i][j] represents how much money the i-th customer keeps in the j-th bank account.

The wealth of any customer is the sum of all values in their row.
Your goal is to identify the customer with the maximum total wealth and return that value.

Example 1:

Input: accounts = [[2,4,1],[5,3,2]]

Output: 10

Explanation:

Customer wealths → 7 and 10. Maximum wealth = 10.

Example 2:

Input: accounts = [[10,0],[3,3],[2,8]]

Output: 10

Explanation:

Wealths → 10, 6, 10. Highest wealth = 10.

Example 3:

Input: accounts = [[1,1,1],[9,0,0],[4,4,1]]

Output: 9

Explanation:

Customer wealths → 3, 9, 9. Richest = 9.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result