You are given an array prices where prices[i] is the price of a given stock on the i-th day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (buy and sell one share of the stock multiple times) with the following restrictions:
Note: You do not need to buy or sell the stock on every day.
Input: prices = [1, 2, 3, 0, 2] Output: 3 Explanation: Buy on day 0 (price=1), sell on day 1 (price=2). Cooldown day 2. Buy on day 3 (price=0), sell on day 4 (price=2). Total profit = (2-1) + (2-0) = 3.
Input: prices = [1] Output: 0 Explanation: Only one day exists - you cannot complete any transaction, so profit is 0.
prices = [1, 2, 3, 0, 2]