2874. Maximum Value of an Ordered Triplet II
You are given a 0-indexed integer array
nums
.Return the maximum value over all triplets of indices
(i, j, k)
such thati < j < k
. If all such triplets have a negative value, return0
.The value of a triplet of indices
(i, j, k)
is equal to(nums[i] - nums[j]) * nums[k]
.
1 | class Solution { |