Shortest and fastest solution in C++
Runtime 0ms, beats 100% of C++ submissions.\n\n\nclass Solution {\n    bool eq24(double i) {\n        return (i > 23.9999 && i < 24.0001);\n    }\n    double op
Runtime 0ms, beats 100% of C++ submissions.\n\n```\nclass Solution {\n    bool eq24(double i) {\n        return (i > 23.9999 && i < 24.0001);\n    }\n    double op(double a, double b, int op) {\n        if (op == 0) return a + b;\n        if (op == 1) return a - b;\n        if (op == 2) return a * b;\n        return a / b;\n    }\npublic:\n    bool judgePoint24(vector<int>& cards) {\n        for (int a = 0; a < 4; a++)\n            for (int b = 0; b < 4; b++)\n                if (a != b)\n                    for (int c = 0; c < 4; c++)\n                        if (a != c && b != c)\n                            for (int d = 0; d < 4; d++)\n                                if (a != d && b != d && c != d) // permutation of 4 cards, index is a,b,c,d\n                                    for (int x = 0; x < 4; x++)\n                                        for (int y = 0; y < 4; y++)\n                                            for (int z = 0; z < 4; z++) // 3 ops \'+-*/\', in x,y,z\n        { // 5 possible RPN(Reverse Polish Notation) : N-Number, O-Ops\n            if (eq24(op(cards[a],op(cards[b],op(cards[c],cards[d],x),y),z))) return true; // NNNNOOO\n            if (eq24(op(cards[a],op(op(cards[b],cards[c],x),cards[d],y),z))) return true; // NNNONOO\n            if (eq24(op(op(cards[a],op(cards[b],cards[c],x),y),cards[d],z))) return true; // NNNOONO\n            if (eq24(op(op(cards[a],cards[b],x),op(cards[c],cards[d],y),z))) return true; // NNONNOO\n            if (eq24(op(op(op(cards[a],cards[b],x),cards[c],y),cards[d],z))) return true; // NNONONO\n        }\n        return false;\n    }\n};\n```\n
['C']