Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 478 Bytes

File metadata and controls

27 lines (18 loc) · 478 Bytes

679 24 Game

Description

link


Solution

  • See Code

Code

class Solution:
    def judgePoint24(self, nums: List[int]) -> bool:
        if len(nums) == 1:
            return math.isclose(nums[0], 24)
        return any(self.judgePoint24([x] + rest)
                for a, b, *rest in itertools.permutations(nums)
                for x in {a+b, a-b, a*b, b and a/b})