Python beats 100% & 100% in two ways easy understand nO(logn) & O(n)
python\n    def maximumProduct(self, nums: List[int]) -> int:\n        nums.sort()\n        return max(nums[0]*nums[1]*nums[-1] , nums[-1]*nums[-2]*nums[-3])\n\
```python\n    def maximumProduct(self, nums: List[int]) -> int:\n        nums.sort()\n        return max(nums[0]*nums[1]*nums[-1] , nums[-1]*nums[-2]*nums[-3])\n```\nsort make a n*log(n) time and it beats 100% and 100%\nthis way can only solve in three numbers\nsecond way is a normal idea solve a normal problom:\n\n```python\nclass Solution:\n    def maximumProduct(self, nums: List[int]) -> int:\n        minOne = sys.maxsize # most small\n        minTwo = sys.maxsize # second small\n        maxOne = - sys.maxsize # most big\n        maxTwo = - sys.maxsize # second big\n        maxThree = - sys.maxsize\n\n        for i in range(len(nums)):\n            if nums[i] <= minOne:\n                minTwo = minOne\n                minOne = nums[i]\n            elif nums[i] <= minTwo: # <\n                minTwo = nums[i]\n            \n            if nums[i] >= maxOne:\n                maxThree = maxTwo\n                maxTwo = maxOne\n                maxOne = nums[i]\n            elif nums[i] >= maxTwo:\n                maxThree = maxTwo\n                maxTwo = nums[i]\n            elif nums[i] >= maxThree:\n                maxThree = nums[i]\n        return max(maxOne*maxTwo*maxThree , maxOne*minOne*minTwo)\n```\nBecause there are positive and negative number\nwhen only positive in last result , we return \n```\nmaxOne*maxTwo*maxThree\n```\nwhen there has 2 negative number in our result, it return :\n```\nmaxOne*minOne*minTwo\n```\n\n**If it helps you , Please give me a vote star\nThanks**
[]