Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def maxProfit(self, prices: List[int]) -> int:
- max_profit = 0
- for i in range(1, len(prices)):
- if prices[i] > prices[i-1]:
- max_profit += prices[i] - prices[i-1]
- return max_profit
Advertisement
Add Comment
Please, Sign In to add comment