Skip to content

Commit f84efbe

Browse files
committed
[PGS] 올바른 괄호 / Level 2 / 11분 (성공)
1 parent a6d9211 commit f84efbe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def solution(s):
2+
answer = True
3+
stack = []
4+
5+
for c in s:
6+
if c == "(":
7+
stack.append(c)
8+
else:
9+
if len(stack) == 0:
10+
answer = False
11+
break
12+
else:
13+
stack.pop()
14+
if len(stack) > 0:
15+
answer = False
16+
return answer

0 commit comments

Comments
 (0)