Python solution
O(n log n) time O(n) space:\n\nclass Solution(object):\n    def maximumProduct(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n  
O(n log n) time O(n) space:\n```\nclass Solution(object):\n    def maximumProduct(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        nums = sorted(nums)\n        if nums[0] >= 0:\n            return nums[-3]*nums[-2]*nums[-1]\n        elif nums[1] < 0:\n            return max(nums[-3]*nums[-2]*nums[-1], nums[0]*nums[1]*nums[-1])\n        else:\n            return nums[-3]*nums[-2]*nums[-1]\n```\nO(n) time O(1) space:\n```\nclass Solution(object):\n    def maximumProduct(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        min1, min2 = float(\'inf\'), float(\'inf\')\n        max1, max2, max3 = -float(\'inf\'), -float(\'inf\'), -float(\'inf\')\n        \n        for n in nums:\n            if n < min1:\n                min1, min2 = n, min1\n            elif n < min2:\n                min2 = n\n            if n > max3:\n                max1, max2, max3 = max2, max3, n\n            elif n > max2:\n                max1, max2 = max2, n\n            elif n > max1:\n                max1 = n\n        if min1 >= 0:\n            return max3*max2*max1\n        elif min2 < 0:\n            return max(max3*max2*max1, min1*min2*max3)\n        else:\n            return max3*max2*max1\n```
[]