Java O(1) space O(n) time solution beat 100%
Simply find out the three largest numbers and the two smallest numbers using one pass.\n\n    public int maximumProduct(int[] nums) {\n        int max1 = Intege
Simply find out the three largest numbers and the two smallest numbers using one pass.\n```\n    public int maximumProduct(int[] nums) {\n        int max1 = Integer.MIN_VALUE, max2 = Integer.MIN_VALUE, max3 = Integer.MIN_VALUE, min1 = Integer.MAX_VALUE, min2 = Integer.MAX_VALUE;\n        for (int n : nums) {\n            if (n > max1) {\n                max3 = max2;\n                max2 = max1;\n                max1 = n;\n            } else if (n > max2) {\n                max3 = max2;\n                max2 = n;\n            } else if (n > max3) {\n                max3 = n;\n            }\n\n            if (n < min1) {\n                min2 = min1;\n                min1 = n;\n            } else if (n < min2) {\n                min2 = n;\n            }\n        }\n        return Math.max(max1*max2*max3, max1*min1*min2);\n    }\n```
[]