C++ | Stack | Easy O(N) solution | 100% Faster
Please upvote if you find this solution helpful :)\nCode:\nTC: O(N), SC: O(N)\n\n\nclass Solution {\npublic:\n    int calPoints(vector<string>& ops) \n    {\n  
**Please upvote if you find this solution helpful :)**\n**Code:**\n**TC: O(N), SC: O(N)**\n\n```\nclass Solution {\npublic:\n    int calPoints(vector<string>& ops) \n    {\n        stack<int> st;\n        int helper1, helper2;\n        \n        for(auto it:ops)\n        {\n            if(it=="C")\n            {\n                st.pop();\n            }\n            \n            else if(it=="D")\n            {\n                st.push(2*st.top());\n            }\n            \n            else if(it=="+")\n            {\n                helper1=st.top();\n                st.pop();\n                helper2=st.top();\n                st.push(helper1);\n                st.push(helper1+helper2);\n            }\n            else\n            {\n                st.push(stoi(it));\n            }\n        }\n        \n        int ans=0;\n        while(!st.empty())\n        {\n            ans += st.top();\n            st.pop();\n        }\n        return ans;\n    }\n};\n```\n\n**Please upvote if you find this solution helpful :)**
['Stack', 'C', 'C++']