sy1214ei 님의 블로그

[Leet Code] 628. Maximum Product of Three Numbers - Python 본문

[Coding]

[Leet Code] 628. Maximum Product of Three Numbers - Python

sy1214ei 2024. 11. 25. 03:08
class Solution:
    def maximumProduct(self, nums: List[int]) -> int:
        nums = sorted(nums)
        return max(nums[0]*nums[1]*nums[-1],nums[-1]*nums[-2]*nums[-3])