We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7e5e35 commit 0f385a7Copy full SHA for 0f385a7
solution/0700-0799/0772.Basic Calculator III/README.md
@@ -80,23 +80,24 @@ class Solution:
80
while q:
81
c = q.popleft()
82
if c.isdigit():
83
- num = num*10 + int(c)
84
- if c == '(':
+ num = num * 10 + int(c)
+ if c == "(":
85
num = dfs(q)
86
- if c in '+-*/)' or not q:
+ if c in "+-*/)" or not q:
87
match sign:
88
case "+":
89
stk.append(num)
90
case "-":
91
stk.append(-num)
92
case "*":
93
- stk.append(stk.pop()*num)
+ stk.append(stk.pop() * num)
94
case "/":
95
- stk.append(int(stk.pop()/num))
+ stk.append(int(stk.pop() / num))
96
num, sign = 0, c
97
if c == ")":
98
break
99
return sum(stk)
100
+
101
return dfs(deque(s))
102
```
103
0 commit comments