My python3 solution


  • 0
    Y
    class Solution(object):
        def maximumProduct(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            nums.sort(reverse=True)
            maybe1 = nums[0] * nums[1] * nums[2]
            maybe2 = nums[-1] * nums[-2] * nums[-3]
            maybe3 = nums[-1] * nums[-2] * nums[0]
            return max(maybe1, maybe2, maybe3)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.