We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fd6bbe commit 9e72eceCopy full SHA for 9e72ece
2 files changed
Week01/122.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def maxProfit(self, prices: List[int]) -> int:
3
+ profit = 0
4
+ for i in range(0, len(prices) - 1):
5
+ temp = prices[i + 1] - prices[i]
6
+ if temp > 0:
7
+ profit = profit + temp
8
+ return profit
Week01/860.py
@@ -0,0 +1,20 @@
+# 860. 柠檬水找零
+ def lemonadeChange(self, bills) -> bool:
+ five = ten = 0
+ for money in bills:
+ if money == 5:
+ five += 1
+ elif money == 10:
9
+ five -= 1
10
+ ten += 1
11
+ else:
12
+ if ten == 0:
13
+ five -= 3
14
15
+ ten -= 1
16
17
+ if five < 0 or ten < 0:
18
+ return False
19
+ return True
20
+
0 commit comments