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(len(prices) - 1):
- max_profit += max(prices[i+1] - prices[i], 0)
- return max_profit
Advertisement
Add Comment
Please, Sign In to add comment