Search
⌘K

Leetcode 2907. Maximum Profitable Triplets With Increasing Prices I

Given an array of prices, choose indices i < j < k with strictly increasing prices[i] < prices[j] < prices[k] to maximize the total profit from two sequential transactions (buy at i, sell at j, then buy at j, sell at k). This is essentially finding an increasing triplet that maximizes combined gain and is typically solved with a small fixed-k DP or linear scans using best-left/best-right values.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.