We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 371fe96 commit f7c5630Copy full SHA for f7c5630
algorithms/BestTimeToBuyAndSellStockII/README.md
@@ -28,5 +28,23 @@ class Solution(object):
28
if max_price > holder:
29
max_profit += max_price - holder
30
31
+ return max_profit
32
+```
33
+or like below:
34
+```python
35
+class Solution(object):
36
+ def maxProfit(self, prices):
37
+ """
38
+ :type prices: List[int]
39
+ :rtype: int
40
41
+ if len(prices) == 0:
42
+ return 0
43
+
44
+ max_profit = 0
45
+ for i in xrange(1, len(prices)):
46
+ if prices[i] > prices[i - 1]:
47
+ max_profit += prices[i] - prices[i - 1]
48
49
return max_profit
50
```
0 commit comments