recursion and permutation Python code
```\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n        def helper(nums, left, right):\n            if left == right:\n            
```\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n        def helper(nums, left, right):\n            if left == right:\n                return set([nums[left]])\n            res = set()\n            for i in range(left, right):\n                res1 = helper(nums, left, i)\n                res2 = helper(nums, i+1, right)\n                # merge\n                for val1 in res1:\n                    for val2 in res2:\n                        res.add(val1 + val2) \n                        res.add(val1 - val2)\n                        res.add(val1 * val2)\n                        if val2 != 0:\n                            res.add(val1 / val2)\n            return res\n        \n        for arr in permutations(cards):\n            # each permutation\n            cur_res = helper(arr, 0, 3)\n            # edge case 3 3 8 8 ---> 8/(3-(8/3))\n            #if 24 in cur_res:\n            #    return True\n            for ans in cur_res:\n                if abs(24 - ans) < 1.0e-5:\n                    return True\n        \n        return False
[]