Skip to content

Commit 9f994ef

Browse files
author
hangyeol
committed
99차 3번 문제 풀이
1 parent e0ced62 commit 9f994ef

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

live9/test99/문제3/백한결.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def solution(s):
77
stack = []
88
rotated = s[i:] + s[:i]
99

10-
print(rotated)
10+
isPerfect = False
1111

1212
for j in rotated:
1313
if j == "(" or j == "[" or j == "{":
@@ -17,9 +17,18 @@ def solution(s):
1717
if stack:
1818
total = stack[-1] + j
1919

20-
if total == "()" or total == "[]" or total == "{}":
21-
count += 1
20+
if total in rightGaulHoList:
21+
stack.pop()
22+
isPerfect = True
23+
else:
24+
isPerfect = False
25+
break
26+
2227
else:
28+
isPerfect = False
2329
break
2430

31+
if isPerfect and not stack:
32+
count += 1
33+
2534
return count

0 commit comments

Comments
 (0)