FastPrepMaximum Product of Three Numbers

Maximum Product of Three Numbers

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREEN
Learn

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[]) → long

Examples

Example 1

nums = [-10,-10,1,3,2]return = 300

The two negative values and 3 produce 300.

Constraints

  • 3 <= nums.length <= 10^5.
  • Values fit in signed 32-bit integers.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public long maximumProductOfThree(int[] nums) {
  // Write your code here.
}
nums[-10,-10,1,3,2]
expected300
Checking account…