Best Time to Buy and Sell Stock with Cooldown Problem
Best Time to Buy and Sell Stock with Cooldown Problem — ExecCode Medium DSA Practice
Solve the Best Time to Buy and Sell Stock with Cooldown problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You may buy/sell multiple times but after you sell you cannot buy on the next day (cooldown). Return max profit. For Best Time to Buy and Sell Stock with Cooldown, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.
Examples
Input prices = [1, 2, 3, 0, 2]; Output 3
Constraints
1 ≤ prices.length ≤ 5000 0 ≤ prices[i] ≤ 1000
Practice Best Time to Buy and Sell Stock with Cooldown free on ExecCode. Browse DSA problems, topic map, and placement guides.