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 ad7c0bd commit 91a21ccCopy full SHA for 91a21cc
solution/1100-1199/1190.Reverse Substrings Between Each Pair of Parentheses/Solution2.py
@@ -4,18 +4,18 @@ def reverseParentheses(self, s: str) -> str:
4
d = [0] * n
5
stk = []
6
for i, c in enumerate(s):
7
- if c == '(':
+ if c == "(":
8
stk.append(i)
9
- elif c == ')':
+ elif c == ")":
10
j = stk.pop()
11
d[i], d[j] = j, i
12
i, x = 0, 1
13
ans = []
14
while i < n:
15
- if s[i] in '()':
+ if s[i] in "()":
16
i = d[i]
17
x = -x
18
else:
19
ans.append(s[i])
20
i += x
21
- return ''.join(ans)
+ return "".join(ans)
0 commit comments