Search
⌘K

Leetcode 2873. Maximum Value of an Ordered Triplet I

Given an array, find the maximum (nums[i] - nums[j]) * nums[k] over all i < j < k (return 0 if all results are negative). Key insight: for each middle index j, maximize the difference using the largest previous nums[i] and the product using the largest subsequent nums[k], so evaluate using prefix/suffix maxima.


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.