You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

  • 121. Best Time to Buy and Sell Stock
  • 122. Best Time to Buy and Sell Stock II
  • 123. Best Time to Buy and Sell Stock III
  • 188. Best Time to Buy and Sell Stock IV
Read more »

Sources:

  1. Bernard Kolman, Robert C. Busby & Sharon Cutler Ros. (2014). Relations and Digraph. Discrete Mathematical Structures (6th ed., pp. 139-204). Pearson.
Read more »

A special type of relation called "tree" in Discrete Mathematics.

Ref: Discrete Mathematical Structures, Sixth Edition, Bernard Kolman, Robert C. Busby, Sharon Cutler Ross.

Read more »
0%