AlgoFrames

Pick the state

Warm-up · Multiple choice · about 4 min

prices[i] is a share's price on day i. You may hold at most one share, and buy and sell as often as you like, but after a sale you must wait one day before buying again.

Which state lets a DP find the best profit?

Learn the idea first: Recognizing DP and choosing the state, a visual lesson.

More Recognizing DP and choosing the state problems