Search
⌘K

Leetcode 2874. Maximum Value of an Ordered Triplet II

Given an array, find the maximum value of (nums[i] - nums[j]) * nums[k] over all ordered triplets i < j < k (return 0 if all such values are negative); this reduces to evaluating each middle index j while choosing the best preceding nums[i] and succeeding nums[k] to maximize the product under n up to 1e5 and nums up to 1e6.


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.