Maximum Product of Three Numbers

Given an integer array, find three numbers whose product is maximum and output the maximum product.

Example

Example 1:

Input:
 [1,2,3]

Output:
 6

Example 2:

Input:
 [1,2,3,4]

Output:
 24

Note

找最小的两个数(对应负数情况)

同时找最大的三个数

Code

Last updated