Search
⌘K

Leetcode 3573. Best Time to Buy and Sell Stock V

Given daily prices and an integer k, pick at most k non-overlapping transactions (each is a pair of days i<j where you either buy-then-sell or short-sell-then-buy) to maximize total profit. Equivalently, choose up to k disjoint index pairs to maximize the sum of the absolute price differences |prices[j] - prices[i]|.


Question Timeline

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

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