Search
⌘K

Leetcode 188. Best Time to Buy and Sell Stock IV

Given a price array and integer k, maximize total profit using at most k non-overlapping buy-sell transactions (cannot hold multiple stocks simultaneously). This is a DP problem over days and transaction counts, with the key optimization that when k >= n/2 it reduces to the unlimited-transactions case solvable greedily.

Asked at:

Oracle


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early February, 2026

Oracle

Senior

Comments

Your account is free and you can post anonymously if you choose.