# 682. Baseball Game

{% embed url="<https://leetcode.com/problems/baseball-game/>" %}

```python
class Solution:
    def calPoints(self, ops: List[str]) -> int:
        record = []
        for r in ops:
            if r == "C":
                record.pop()
            elif r == "D":
                record.append(record[-1]*2)
            elif r == "+":
                record.append(record[-1]+record[-2])
            else:
                record.append(int(r))
        return sum(record)
```
