/ ALGORITHM

프로그래머스 - 올바른 괄호

image-20230118202227522

def solution(s):
    stack = []
    for i in s:
        if not stack:
            if i==')':
                return False
        elif i==")":
            stack.pop()
            continue
        stack.append(i)
        
    if stack:
        return False
    else:
        return True