[C++] Solution with one stack
Straightforward C++ solution using one stack. O(n) time and O(n) space.\n\n\n    int calPoints(vector<string>& ops) {\n        if (ops.empty()) return 0;\n     
Straightforward C++ solution using one stack. O(n) time and O(n) space.\n\n```\n    int calPoints(vector<string>& ops) {\n        if (ops.empty()) return 0;\n        \n        stack<int> pts;\n        int ans = 0;\n        \n        for (int i=0; i<ops.size(); i++) {\n            if (ops[i] == "C") {\n                ans -= pts.top();\n                pts.pop();\n            } else if (ops[i] == "D") {\n                pts.push(pts.top()*2);\n                ans += pts.top();\n            } else if (ops[i] == "+") {\n                int a = pts.top();\n                pts.pop();\n                int b = pts.top();\n                pts.push(a);\n                \n                ans += (a+b);\n                pts.push(a+b);\n            } else {\n                int n = stoi(ops[i]);\n                ans += n;\n                pts.push(n);\n            }\n        }\n        \n        return ans;\n    }\n```
['Stack', 'C']