-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRichest_Customer_Wealth.py
19 lines (16 loc) · 2.16 KB
/
Richest_Customer_Wealth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def maximumWealth(accounts):
global free
global temp
for i in accounts:
for j in i:
# print(j)
temp += j
free.append(temp)
# print(" ")
temp = 0
return max(free)
# accounts=[[51,64,25,30,2,11,56,31,92,79,90,2,17],[82,79,81,96,30,18,34,86,42,16,61,27,35],[68,78,9,34,8,47,87,61,14,93,44,70,22],[48,61,69,73,15,84,69,2,74,98,85,38,39],[73,10,87,60,95,15,97,90,7,76,73,88,66],[82,78,73,86,1,71,25,52,37,57,77,4,6],[97,37,65,98,1,72,62,86,74,52,95,55,83],[23,23,88,74,40,55,69,65,17,49,67,48,32],[78,81,2,30,65,80,44,38,81,90,34,49,60],[65,37,56,17,92,7,85,11,81,58,65,1,22],[5,34,26,68,25,83,38,78,73,47,34,6,51],[36,24,43,66,11,35,35,24,66,52,50,14,37],[57,77,47,52,14,79,66,80,79,5,66,32,56],[79,93,35,22,97,53,82,75,74,84,62,60,40],[25,51,30,85,52,46,55,74,100,67,100,29,48],[16,69,95,12,94,37,23,77,5,93,19,82,4],[19,46,31,58,49,84,50,7,63,56,91,16,17],[4,39,34,84,10,19,11,14,41,22,58,5,68],[72,86,81,80,9,55,38,35,89,32,51,78,8],[76,64,62,17,50,79,41,42,33,3,26,21,61],[62,16,100,18,62,15,40,15,56,98,5,8,37],[41,16,92,52,68,53,93,11,11,37,59,1,4],[61,99,86,37,89,48,34,67,84,20,57,71,20],[54,84,93,28,98,67,96,29,98,100,46,31,70],[23,54,87,61,83,30,12,24,51,11,20,5,58],[87,23,39,50,67,21,100,15,18,79,44,92,51],[78,15,82,68,12,12,81,72,88,73,72,60,10],[9,62,87,80,92,100,85,100,19,19,14,25,9],[9,20,29,48,56,10,78,20,76,99,39,1,7],[71,7,61,51,6,76,48,65,13,52,1,1,37],[74,10,37,78,1,31,43,17,65,17,60,73,84],[9,61,30,54,2,65,98,75,70,42,87,30,91],[63,25,7,36,64,61,100,2,51,39,9,83,66],[4,15,35,51,97,72,30,80,38,35,41,63,64],[59,81,46,98,46,95,76,48,44,27,39,31,23],[11,86,11,71,6,1,6,31,79,36,66,19,62],[49,44,51,64,72,49,35,43,21,59,1,82,87],[62,29,51,73,66,4,51,76,7,13,58,36,6],[44,56,67,84,78,68,16,34,3,51,79,41,53],[27,20,34,46,5,49,18,31,52,99,21,20,46],[73,39,24,70,14,14,29,80,83,37,87,44,4],[5,60,31,11,98,89,51,59,35,95,39,2,56],[97,76,30,73,84,74,68,88,15,84,41,54,65],[56,92,3,66,63,25,63,30,77,73,95,19,53],[80,93,34,45,61,85,44,32,93,51,5,62,2],[35,95,26,4,56,23,13,92,83,66,29,94,93],[92,76,67,16,23,2,42,12,32,59,47,46,97]]
accounts = [[1, 2, 3], [3, 2, 1]]
free = []
temp = 0
print(maximumWealth(accounts))