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 with the following restrictions: After you sell your stock, you cannot buy stock on the next day (i.e., cooldown one day).
- An array of integers
prices.
Input: prices = [1, 2, 3, 0, 2]
Output: 3
Explanation: Buy on day 0, sell on day 2 (profit=2). Buy on day 3, sell on day 4 (profit=2). Total = 3.