Baseball Game || cpp || Simple Approach
\n\nclass Solution {\npublic:\n    int calPoints(vector<string>& op) {\n        vector<int> v;\n        for(int i=0;i<op.size();i++){\n            int n=v.size(
\n```\nclass Solution {\npublic:\n    int calPoints(vector<string>& op) {\n        vector<int> v;\n        for(int i=0;i<op.size();i++){\n            int n=v.size();\n            if(op[i] == "+") v.push_back(v[n-1]+v[n-2]);\n            else if(op[i] == "C") v.pop_back();\n            else if(op[i] == "D") v.push_back(2*v[n-1]);\n            else v.push_back(stoi(op[i]));\n        }\n        int sum=0;\n        for(auto s:v) sum+=s;\n        return sum;\n    }\n};\n```
['C++']