Recall & Review
beginner
What is the main goal in the 'Buy and Sell Stocks' problem?
To find the maximum profit by choosing the best days to buy and sell stocks given their prices over time.
Click to reveal answer
beginner
In the single transaction variant, what is the key idea to find maximum profit?
Track the minimum price seen so far and calculate the profit if sold today; update max profit accordingly.
Click to reveal answer
intermediate
How does the multiple transactions variant differ from the single transaction variant?
You can buy and sell multiple times, so the goal is to sum all positive price differences between consecutive days.
Click to reveal answer
intermediate
What constraint does the 'at most two transactions' variant add?
You can complete at most two buy-sell transactions to maximize profit, requiring tracking profits from left and right passes.
Click to reveal answer
advanced
Why is dynamic programming useful in the 'Buy and Sell Stocks with cooldown' variant?
Because you must consider cooldown days after selling, DP helps track states like holding, sold, and cooldown to maximize profit.
Click to reveal answer
In the single transaction stock problem, what do you track to find max profit?
✗ Incorrect
Tracking the minimum price so far allows calculating potential profit if sold today, updating max profit.
For multiple transactions allowed, how do you calculate max profit?
✗ Incorrect
Adding all positive price differences captures profit from every profitable buy-sell pair.
What is the main challenge in the 'at most two transactions' variant?
✗ Incorrect
You must find two non-overlapping transactions that maximize combined profit.
In the cooldown variant, what happens after selling a stock?
✗ Incorrect
Cooldown means you cannot buy on the day immediately after selling.
Which approach is best for solving complex variants like cooldown or transaction limits?
✗ Incorrect
Dynamic Programming efficiently tracks states and decisions to maximize profit under constraints.
Explain how to find maximum profit with only one buy and one sell allowed.
Think about the lowest price before the current day.
You got /3 concepts.
Describe the difference between multiple transactions allowed and cooldown variants.
Cooldown adds waiting days after selling.
You got /3 concepts.