[LeetCode] Maximum Profitable Triplets With Increasing Prices I

1 · · Dec. 11, 2023, 8:41 a.m.
2907. Maximum Profitable Triplets With Increasing Prices I Given the 0-indexed arrays prices and profits of length n. There are n items in an store where the ith item has a price of prices[i] and a profit of profits[i]. We have to pick three items with the following condition: prices[i] < prices[j] < prices[k] where i < j < k. If we pick items with indices i, j and k satisfying the above condition, the profit would be profits[i] + profits[j] + profits[k]. Return the maximum profit we can get,...