C++ without Stack
\nclass Solution {\npublic:\n    int calPoints(vector<string>& operations) {\n        \n        vector<int> ans;\n        int n = operations.size();\n        \n
```\nclass Solution {\npublic:\n    int calPoints(vector<string>& operations) {\n        \n        vector<int> ans;\n        int n = operations.size();\n        \n        for(int i=0;i<operations.size();i++){\n            if(operations[i] == "C"){\n                ans.pop_back();\n            }else if(operations[i] == "D"){\n                ans.emplace_back(2*ans[ans.size()-1]);\n            }else if(operations[i] == "+"){\n                ans.emplace_back(ans[ans.size()-1] + ans[ans.size()-2]);\n            }else{\n                int n = stoi(operations[i]);\n                ans.emplace_back(n);\n            }\n        }\n        \n        int sum = 0;\n        \n        for(auto it : ans){\n            sum+=it;\n        }\n        \n        return sum;\n        \n    }\n};\n```
['C++']