Maximum Product of Three Numbers
Problem statement
Choose exactly three distinct indices from nums. Return the maximum product of the three selected values as a signed 64-bit integer.
Function
maximumProductOfThree(nums: int[]) → longExamples
Example 1
nums = [-10,-10,1,3,2]return = 300The two negative values and 3 produce 300.
Constraints
3 <= nums.length <= 10^5.- Values fit in signed 32-bit integers.