leetcode 628 Maximum Product of Three Numbers

来源:互联网 发布:淘宝网老年80岁女冬装 编辑:程序博客网 时间:2024/05/20 04:15
class Solution {    public int maximumProduct(int[] nums) {        Arrays.sort(nums);  //排序        int t=nums.length;                 return Math.max(nums[t-1]*nums[t-2]*nums[t-3],nums[0]*nums[1]*nums[t-1]);       }}

原创粉丝点击