Skip to content

Commit 68c2aa3

Browse files
authored
Merge pull request vJechsmayr#586 from nainys/master
Add: Solution to 1402. Reducing Dishes
2 parents 21b2694 + d5596d4 commit 68c2aa3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

LeetCode/1402_Reducing_Dishes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def maxSatisfaction(self, satisfaction: List[int]) -> int:
3+
4+
satisfaction.sort(reverse=True)
5+
ans = cur_sum = 0
6+
for ele in satisfaction:
7+
cur_sum += ele
8+
if cur_sum >= 0:
9+
ans += cur_sum
10+
11+
return ans;

0 commit comments

Comments
 (0)