[Python] Elegant Solution
No itertools required.\n\ncards is used as both queue and stack to achieve permutations and back tracking\n\n\npython\nclass Solution:\n    def judgePoint24(sel
No `itertools` required.\n\n`cards` is used as both **queue** and **stack** to achieve **permutations** and **back tracking**\n\n\n``` python\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n        if len(cards) == 1:\n            return math.isclose(cards[0], 24)\n        \n        for _ in range(len(cards)):\n            a = cards.pop(0) # fetch first card\n            for _ in range(len(cards)):\n                b = cards.pop(0) # fetch second card\n                for value in [a + b, a - b, a * b, b and a / b]: # calculate these two cards\n                    cards.append(value) # save value\n                    if self.judgePoint24(cards):\n                        return True\n                    cards.pop() # clear value\n                cards.append(b) # put second card back\n            cards.append(a) # put first card back\n        return False\n```
['Backtracking', 'Python']