Tap here to switch tabs
Problem
Submissions

Problem: Maximum Value of an Ordered Triplet I

Try to solve the Maximum Value of an Ordered Triplet I problem.

Statement

You are given an integer array nums.

An ordered triplet of indices (i, j, k) is valid if i<j<ki < j < k. The value of this triplet is defined as (nums[i] −- nums[j]) ⋅\cdot nums[k].

Return the maximum value among all valid triplets. If all triplet values are negative, return 00.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Value of an Ordered Triplet I

Try to solve the Maximum Value of an Ordered Triplet I problem.

Statement

You are given an integer array nums.

An ordered triplet of indices (i, j, k) is valid if i<j<ki < j < k. The value of this triplet is defined as (nums[i] −- nums[j]) ⋅\cdot nums[k].

Return the maximum value among all valid triplets. If all triplet values are negative, return 00.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤106\leq 10^6