Leetcode 628. Maximum Product of Three Numbers

送分题

class Solution(object):
    def maximumProduct(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums.sort()
        return max(nums[0] * nums[1] * nums[-1], nums[-1] * nums[-2] * nums[-3])

猜你喜欢

转载自www.cnblogs.com/zywscq/p/10550017.html