题解 | #三个数的最大乘积#
三个数的最大乘积
http://www.nowcoder.com/practice/8ae05c2913fe438b8b14f3968f64fc0b
import java.util.*;
public class Solution {
/**
* 最大乘积
* @param A int整型一维数组
* @return long长整型
*/
public long solve (int[] A) {
// write code here
Arrays.sort(A);
return 1L*A[0]*A[1]*A[A.length-1]>1L*A[A.length-1]*A[A.length-2]*A[A.length-3]?
1L*A[0]*A[1]*A[A.length-1]:1L*A[A.length-1]*A[A.length-2]*A[A.length-3];
}
}