628_Maximum Product of Three Numbers
Input: [1,2,3]
Output: 6Input: [1,2,3,4]
Output: 24Solution:
def maximumProduct(nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
return max(nums[0]*nums[1]*nums[-1], nums[-1]*nums[-2]*nums[-3])Last updated