You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth 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.
Input: accounts = [[1,5],[7,3],[3,5]]
Output: 10
Explanation:
1st customer has wealth = 6
2nd customer has wealth = 10
3rd customer has wealth = 8
The 2nd customer is the richest with a wealth of 10.
1-1) add all items inside
1-2) if the total is bigger than before total, replace it
"""
1672. Richest Customer Wealth
<https://leetcode.com/problems/richest-customer-wealth/>
You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth 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.
"""
accounts = [[1,5],[7,3],[3,5]]
i = 0
j = 0
total = 0
maximum = 0
while i < len(accounts):
while j < len(accounts[i]):
total += accounts[i][j]
j += 1
if maximum < total:
maximum = total
total = 0
i += 1
j = 0
print(maximum)
in leetcode