Best Time to Buy and Sell Stock II
Solution Code
class Solution:def maxProfit(self, prices: list[int]) -> int:max_profit = 0for i in range(1, len(prices)):if prices[i] > prices[i - 1]:max_profit += prices[i] - prices[i - 1]return max_profitTime Complexity
O(N)
Space Complexity
O(1)

