💻 하나씩 차곡차곡/프로그래머스 (Python)
[프로그래머스/Lv.2/Python] 올바른 괄호
뚜루리
2024. 1. 16. 09:55
728x90
320x100
def solution(s):
stack = []
for c in s:
if c == "(":
stack.append(c)
else:
if stack: # 배열이 비어있지 않으면
stack.pop()
else: # 배열이 비여있으면
return False
if stack:
return False
return True
728x90
320x100