188. Best Time to Buy and Sell Stock IV (Hard)

Say you have an array for which theithelement is the price of a given stock on dayi.

Design an algorithm to find the maximum profit. You may complete at most k transactions.

Note:
You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).

Follow Up:

1.刚好k次

results matching ""

    No results matching ""