Problem 2921 · Medium

Maximum Profitable Triplets With Increasing Prices II

Find the best strictly increasing price triplet. Two Fenwick max trees over price ranks supply each middle index’s best partners.

Open the interactive visualisation