Skip to content

Commit

Permalink
Time: 40 ms (25.45%), Space: 16.6 MB (40.89%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakeer-official committed Jul 11, 2024
1 parent 06fd450 commit fc20f5a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution:
def reverseParentheses(self, s: str) -> str:
lst = list(s)
x = []
for i in lst:
if i == ')':
sor = ""
while x[-1] != '(':
sor += x.pop()
x.pop()
sort = list(sor)
x.extend(sort)
else:
x.append(i)

x = "".join(x)
return x

0 comments on commit fc20f5a

Please sign in to comment.