Solution
C++ []\nclass Solution {\npublic:\n    std::vector<double> available_nums;\n    bool bt() {\n        if (available_nums.size() == 1) {\n            auto v = ava
```C++ []\nclass Solution {\npublic:\n    std::vector<double> available_nums;\n    bool bt() {\n        if (available_nums.size() == 1) {\n            auto v = available_nums.back();\n            return abs(v - 24.) < .01;\n        }\n        for (size_t i = 0; i < available_nums.size(); ++i) {\n            for (size_t j = i + 1; j < available_nums.size(); j++)\n            {\n                auto op1 = available_nums[i];\n                auto op2 = available_nums[j];\n                available_nums.erase(available_nums.begin() + j);\n                available_nums.erase(available_nums.begin() + i);\n                auto bt_help = [&](double curr) {\n                    available_nums.push_back(curr);\n                    if (bt()) return true;\n                    available_nums.pop_back();\n                    return false;\n                };\n                if (bt_help(op1 + op2)) return true;\n                if (bt_help(op1 - op2)) return true;\n                if (bt_help(op2 - op1)) return true;\n                if (bt_help(op1 / op2)) return true;\n                if (bt_help(op2 / op1)) return true;\n                if (bt_help(op2 * op1)) return true;\n                available_nums.insert(available_nums.begin() + i, op1);\n                available_nums.insert(available_nums.begin() + j, op2);\n            }\n        }\n        return false;\n    }\n    bool judgePoint24(vector<int>& cards) {\n        for (const auto card : cards) {\n            available_nums.push_back(card);\n        }\n        return bt();\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def judgePoint24(self, cards: List[int]) -> bool:\n        if len(cards) == 2:\n            return abs((cards[0] + cards[1]) - 24) < 0.00001 or \\\n            abs((cards[0] * cards[1]) - 24) < 0.00001 or \\\n            abs((cards[0] - cards[1]) - 24) < 0.00001 or \\\n            abs((cards[1] - cards[0]) - 24) < 0.00001 or \\\n            abs((cards[1] and (cards[0] / cards[1])) - 24) < 0.00001 or \\\n            abs((cards[0] and (cards[1] / cards[0])) - 24) < 0.00001\n\n        for i in range(len(cards) - 1):\n            cards[0], cards[i] = cards[i], cards[0]\n            for j in range(i+1, len(cards)):\n                cards[1], cards[j] = cards[j], cards[1]\n                computations = [\n                    cards[0] + cards[1],\n                    cards[0] * cards[1],\n                    cards[0] - cards[1],\n                    cards[1] - cards[0],\n                    cards[1] and cards[0] / cards[1],\n                    cards[0] and cards[1] / cards[0]\n                ]\n                remaining = cards[2:]\n                for computation in computations:\n                    found = self.judgePoint24(remaining + [computation])\n                    if found:\n                        return True\n                cards[1], cards[j] = cards[j], cards[1]\n            cards[0], cards[i] = cards[i], cards[0]\n        return False\n```\n\n```Java []\nclass Solution {\n    private static final double EPS = 1e-6;\n    private boolean backtrack(double[] A, int n) {\n        if(n == 1) return Math.abs(A[0] - 24) < EPS;\n        for(int i = 0; i < n; i++) {\n            for(int j = i + 1; j < n; j++) {\n                double a = A[i], b = A[j];\n                A[j] = A[n-1];\n                A[i] = a + b;\n                if(backtrack(A, n - 1)) return true;\n                A[i] = a - b;\n                if(backtrack(A, n - 1)) return true;\n                A[i] = b - a;\n                if(backtrack(A, n - 1)) return true;\n                A[i] = a * b;\n                if(backtrack(A, n - 1)) return true;\n                if(Math.abs(b) > EPS) {\n                    A[i] = a / b;\n                    if(backtrack(A, n - 1)) return true;\n                }\n                if(Math.abs(a) > EPS) {\n                    A[i] = b / a;\n                    if(backtrack(A, n - 1)) return true;\n                }\n                A[i] = a; A[j] = b;\n            }\n        }\n        return false;\n    }\n    public boolean judgePoint24(int[] nums) {\n        double[] A = new double[nums.length];\n        for(int i = 0; i < nums.length; i++) A[i] = nums[i];\n        return backtrack(A, A.length);\n    }\n}\n```\n
['C++', 'Java', 'Python3']