[C++] Simple C++ Code
\n# If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n    d
\n# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    double error=0.001;\n    vector<double> opnxy(double x, double y)\n    {\n        vector<double> ans;\n        if(x > error)\n            ans.push_back(x/y);\n        if(y > error)\n            ans.push_back(y/x);\n        ans.push_back(x+y);\n        ans.push_back(x*y);\n        ans.push_back(x-y);\n        ans.push_back(y-x);\n        return ans;\n    }\n    bool dfs(vector<double> &dbl)\n    {\n        if(dbl.size() == 1){\n            if(abs(24-dbl[0]) < error)\n                return true;\n            return false;\n        }\n        for(int i = 0; i < dbl.size(); i++)\n        {\n            for(int j = 0; j < i; j++)\n            {\n                if(i == j)\n                    continue;\n                double x = dbl[i], y = dbl[j];\n                vector<double> opn = opnxy(x, y);\n                dbl.erase(dbl.begin()+i);\n                dbl.erase(dbl.begin()+j);\n                for(double &val : opn)\n                {\n                    dbl.push_back(val);\n                    if(dfs(dbl)) return true;\n                    dbl.pop_back();\n                }\n                dbl.insert(dbl.begin()+j,y);\n                dbl.insert(dbl.begin()+i,x);\n            }\n        }\n        return false;\n    }\npublic:\n    bool judgePoint24(vector<int>& cards) {\n        vector<double> dbl (cards.begin(),cards.end());\n        return dfs(dbl);\n    }\n};\n```
['Backtracking', 'C']