2-liner Python solution with explanations
There are two possible ways to get the largest number:\n1. biggest number * 2nd biggest * 3rd biggest\n2. biggest number * smallest number * 2nd smallest number
There are two possible ways to get the largest number:\n1. biggest number * 2nd biggest * 3rd biggest\n2. biggest number * smallest number * 2nd smallest number (if the two smallest numbers are negative)\n\nThis formula will also work in the case there are all negative numbers, in which the smallest negative number will be the result (based on condition 1).\n\nWe can simply sort the numbers and retrieve the biggest/smallest numbers at the two ends of the array.\n\n```\ndef maximumProduct(self, nums):\n  """\n  :type nums: List[int]\n  :rtype: int\n  """\n  nums = sorted(nums)\n  return max(nums[0]*nums[1]*nums[-1], nums[-3]*nums[-2]*nums[-1])\n```
[]