Python Easy 95% Runtime Memoization with Comments
\nimport functools\n\nclass Solution:\n    # Helper function to get the values for all possible cominations of num1 and num2 using different mathematical operat
```\nimport functools\n\nclass Solution:\n    # Helper function to get the values for all possible cominations of num1 and num2 using different mathematical operators\n    def getRes(self, num1, num2):\n        res = [num1+num2, num1-num2, num2-num1, num1*num2]\n        if num1 != 0:\n            res.append(num2/num1)\n        if num2 != 0:\n            res.append(num1/num2)\n        return res\n        \n\t# Created a new function with tuple as input instead of list as lists are not hashable and cache cannot be used for them\n    @functools.lru_cache(maxsize=None)\n\tdef jd(self, cards) -> bool:\n        # If only two elements are left in cards, check if their combination can return 24\n\t\tif len(cards) == 2:\n            for i in self.getRes(cards[0], cards[1]):\n                # Need to round off as there can be cases like 23.99999 due to rounding off in previous steps\n\t\t\t\tif 24.0 == round(i, 5):\n                    return True\n            return False\n            \n        for i in range(0, len(cards)):\n            for j in range(i+1, len(cards)):\n                # Creating a new list after removing the two elements in consideration\n\t\t\t\tc = [x for t, x in enumerate(cards) if i != t != j]\n                vals = self.getRes(cards[i], cards[j])\n                # Recursive call after replacing the elements removed above with their combination\n\t\t\t\tfor val in vals:\n                    if self.jd(tuple(c)+(val,)):\n                        return True\n        return False\n    \n    def judgePoint24(self, cards: List[int]) -> bool:\n        return self.jd(tuple(cards))\n```
[]