Simple Java Solution


  • 0
    J
    public class Solution {
        public int maximumProduct(int[] nums) {
            int n =nums.length;
            Arrays.sort(nums);
            return Math.max(nums[n-1]*nums[n-2]*nums[n-3],nums[n-1]*nums[0]*nums[1]);
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.