파이썬 코딩테스트/프로그래머스

프로그래머스 / 짝지어 제거하기 / 파이썬

S.T.Lee 2022. 10. 6. 23:01
def solution(s):
    right = []
    for i in s:
        if len(right) == 0:
            right.append(i)
        elif right[-1] == i:
            right.pop()
        else:
            right.append(i)
    if right:
        return 0
    return 1