We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0ced62 commit 9f994efCopy full SHA for 9f994ef
1 file changed
live9/test99/문제3/백한결.py
@@ -7,7 +7,7 @@ def solution(s):
7
stack = []
8
rotated = s[i:] + s[:i]
9
10
- print(rotated)
+ isPerfect = False
11
12
for j in rotated:
13
if j == "(" or j == "[" or j == "{":
@@ -17,9 +17,18 @@ def solution(s):
17
if stack:
18
total = stack[-1] + j
19
20
- if total == "()" or total == "[]" or total == "{}":
21
- count += 1
+ if total in rightGaulHoList:
+ stack.pop()
22
+ isPerfect = True
23
+ else:
24
25
+ break
26
+
27
else:
28
29
break
30
31
+ if isPerfect and not stack:
32
+ count += 1
33
34
return count
0 commit comments