Easy to understand solution [Swift]
\n\n# Code\n\nclass Solution {\n    func calPoints(_ operations: [String]) -> Int {\n        var total = [Int]()\n    \n        for operation in operations {\n 
\n\n# Code\n```\nclass Solution {\n    func calPoints(_ operations: [String]) -> Int {\n        var total = [Int]()\n    \n        for operation in operations {\n            switch operation {\n            case "+":\n                total.append(total.suffix(2).reduce(0, +))\n            case "D":\n                total.append((total.last ?? 0) * 2)\n            case "C":\n                total = total.dropLast()\n            default:\n                total.append(Int(operation) ?? 0)\n            }\n        }\n        return total.reduce(0, +)\n    }\n}\n```
['Swift']