Easy c++ solution using stack with explanation
Code\n\nclass Solution {\npublic:\n    int calPoints(vector<string>& op) {\n        stack<int>s;//create a stack\n        int sum1=0;\n\n        for(int i=0; i<
# Code\n```\nclass Solution {\npublic:\n    int calPoints(vector<string>& op) {\n        stack<int>s;//create a stack\n        int sum1=0;\n\n        for(int i=0; i<op.size(); i++)\n        {\n            int temp=0,sum=0;\n            if(op[i]=="+" && !s.empty())\n            {\n                // we need to make a temporary variable in order to access the value before top\n                // store the value of top in temp and then pop the top value so that we can get the new top value and perform sum\n                  \n                temp=s.top();\n                s.pop();\n                sum = temp + s.top();\n                s.push(temp);// again push the temp variable in the stack\n                s.push(sum);// push the sum we got\n            }\n            else if(op[i]=="C" && !s.empty())// it is important to check if the stack value is not empty\n            {\n                // if the value is C then we simply need to pop from stack\n                s.pop();\n            }\n            else if(op[i]=="D" && !s.empty())\n            {\n                s.push(2*s.top());// push the value 2 times the top value\n            }\n            else\n            {\n                s.push(stoi(op[i]));// convert string value into integer using stoi function and push into stack\n            }\n        }\n\n        while (!s.empty()) // iterate through stack till its empty and do the sum\n        {\n            sum1 += s.top();\n            s.pop();\n        }\n    \n\n        return sum1;\n    }\n};\n```
['Array', 'Stack', 'C++']