[LeetCode]#1672. Richest Customer Wealth

Input: accounts = [[1,2,3],[3,2,1]]
Output: 6
Explanation:
1st customer has wealth = 1 + 2 + 3 = 6
2nd customer has wealth = 3 + 2 + 1 = 6
Both customers are considered the richest with a wealth of 6 each, so return 6.
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.
Input: accounts = [[2,8,7],[7,1,3],[1,9,5]]
Output: 17
  1. Sum list a, b, c
  2. Find the largest one.
class Solution:
def maximumWealth(self, accounts):
ans, curr= 0, 0
for i in accounts:
for j in i:
curr+=j
ans=max(ans,curr)
curr=0
return ans

--

--

--

Interesting in any computer science.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Integrate Video Conferencing API Into Your Application or Website With Clan Meeting Powered By…

10 Top Staff Augmentation Companies

Algorithm

Making Minecraft mining less monotonous with python PT.2

READ/DOWNLOAD*% Software Assessment: Reliability,

5 CSS rules you might not know

Introduction to Kotlin and Basics (Android)

Is AMP for You? A Developer’s Quest to Enlightenment

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fatboy Slim

Fatboy Slim

Interesting in any computer science.

More from Medium

Learn more about the Data Scientist position at Mytraffic thanks to David Tang

No Whiteboard: Hiring Companies That Don’t Require a Coding Test

A pencil resting on a testing booklet.

Interview Tips: How to use Lists efficiently in Python

Top 60 Data Science Interview Questions Data Science Interview Questions