나의 풀이

def solution(s):
    tmp = []
    for i in s:
        if i == '(':
            tmp.append(i)
        elif i == ')' and any(tmp):
            tmp.pop()
        else:
            return False

    return not any(tmp)

+ Recent posts