Skip to content

Commit e0ced62

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

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
def solution(s):
2+
count = 0
3+
4+
rightGaulHoList = ["()", "[]", "{}"]
5+
6+
for i in range(len(s)):
7+
stack = []
8+
rotated = s[i:] + s[:i]
9+
10+
print(rotated)
11+
12+
for j in rotated:
13+
if j == "(" or j == "[" or j == "{":
14+
stack.append(j)
15+
16+
elif j == ")" or j == "]" or j == "}":
17+
if stack:
18+
total = stack[-1] + j
19+
20+
if total == "()" or total == "[]" or total == "{}":
21+
count += 1
22+
else:
23+
break
24+
25+
return count

0 commit comments

Comments
 (0)