Stock trading with cooldown

Write codeMedium25 minBloomberg style

Your task

Given daily prices of a stock, you may complete as many buy/sell transactions as you like, but you can hold at most one share at a time and after you sell you must wait one full day (cooldown) before buying again. Return the maximum profit. The price list may be empty.

Examples

stock_with_cooldown(prices: list[int]) -> int
Example 1
Inputstock_with_cooldown([1, 2, 3, 0, 2])
Output3