Skip to content

Commit 472e331

Browse files
committed
✨ upload T682 python solution
1 parent 856e2c7 commit 472e331

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
39 / 39 test cases passed.
3+
Runtime: 32 ms
4+
Memory Usage: 15.2 MB
5+
"""
6+
class Solution:
7+
def calPoints(self, ops: List[str]) -> int:
8+
stk = []
9+
for op in ops:
10+
if op == 'C': stk.pop()
11+
elif op == '+': stk.append(stk[-2] + stk[-1])
12+
elif op == 'D': stk.append(stk[-1] * 2)
13+
else: stk.append(int(op))
14+
return sum(stk)

0 commit comments

Comments
 (0)