Skip to content

Commit

Permalink
[프로그래머스] 올바른 괄호
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdgua01 committed Sep 9, 2024
1 parent 437124d commit fa54062
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions coding_test/programmers/stack_queue/parentheses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def solution(s):
opened = []
for char in s:
if char == "(":
opened.append(char)
elif not opened:
return False
else:
opened.pop()
return not bool(opened)

0 comments on commit fa54062

Please sign in to comment.