We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f78ed9f commit 502ce28Copy full SHA for 502ce28
python/0122-best-time-to-buy-and-sell-stock-ii.py
@@ -0,0 +1,7 @@
1
+class Solution:
2
+ def maxProfit(self, prices: List[int]) -> int:
3
+ max_profit = 0
4
+ for i in range(1, len(prices)):
5
+ if prices[i] > prices[i-1]:
6
+ max_profit += prices[i] - prices[i-1]
7
+ return max_profit
0 commit comments