✔️ [C++] CYCLE, Explained
UPVOTE if you like (\uD83C\uDF38\u25E0\u203F\u25E0), If you have any question, feel free to ask.\n\nJust iterate over all characters, check all conditions and b
**UPVOTE if you like (\uD83C\uDF38\u25E0\u203F\u25E0), If you have any question, feel free to ask.**\n\nJust iterate over all characters, check all conditions and build record list. In the end we just return the sum.\n\nTime: **O(n)**\nSpace: **O(n)**\n\nRuntime: 3 ms, faster than **86.92%** of C++ online submissions for Baseball Game.\nMemory Usage: 8.2 MB, less than **99.88%** of C++ online submissions for Baseball Game.\n\n```\nclass Solution {\npublic:\n    int calPoints(vector<string>& ops) {\n        vector<int> record;\n        for (string ch : ops) {\n            if (ch == "C")\n                record.pop_back();\n            else if (ch == "D")\n                record.push_back(record.back() * 2);\n            else if (ch == "+")\n                record.push_back(record.back() + record[record.size() - 2]);\n            else\n                record.push_back(stoi(ch));\n        }\n        \n        return accumulate(record.begin(), record.end(), 0);\n    }\n};\n```\n\n**UPVOTE if you like (\uD83C\uDF38\u25E0\u203F\u25E0), If you have any question, feel free to ask.**
['C']