Python 3   ||   9 lines, dfs   ||   T/S: 37% / 99%
\ndiv = lambda x,y: reduce(truediv,(x,y)) if y else inf\nops = (add, sub, mul, div)\n\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n\
```\ndiv = lambda x,y: reduce(truediv,(x,y)) if y else inf\nops = (add, sub, mul, div)\n\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n\n        def dfs(c: list) -> bool:\n\n            if len(c) <2 : return isclose(c[0], 24)\n            \n            for p in set(permutations(c)):\n                for num in {reduce(op,p[:2]) for op in ops}:\n                    if dfs([num] + list(p[2:])): return True\n\n            return False        \n        \n        return dfs(cards)\n```\n[https://leetcode.com/problems/24-game/submissions/992130414/](https://leetcode.com/problems/24-game/submissions/992130414/)\n\n\n\nI could be wrong, but I think that time complexity is *O*(1) and space complexity is *O*(1). (The time and space will improve with fewer distinct digits in cards.)
['Python3']