Problem 4069 · Hard

Best Time to Buy and Sell Stock with Cooldown II

For each sale day, take the best buy that is still free after the cooldown, subtract the holding fee for that length, and keep the highest total.

Open the interactive visualisation