Skip to content

Commit ed58ca6

Browse files
authored
Create LC_1402.py
1 parent 469d723 commit ed58ca6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

LC_1402.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def maxSatisfaction(self, satisfaction: List[int]) -> int:
3+
A = satisfaction
4+
res = total = 0
5+
A.sort()
6+
while A and A[-1] + total > 0:
7+
total += A.pop()
8+
res += total
9+
return res

0 commit comments

Comments
 (0)