Problem 2907 · Medium

Maximum Profitable Triplets With Increasing Prices I

Pick three indices whose prices strictly increase. For each middle index, take the best profit on each side and add them.

Open the interactive visualisation