[Level 2] 짝지어 제거하기

나며기·2021년 9월 21일
0

programmers

목록 보기
57/111
post-thumbnail
def solution(s):
    stack = []
    for i in s:
        if len(stack) == 0:
            stack.append(i)
        elif stack[-1] == i:
            stack.pop()
        else:
            stack.append(i)
    if len(stack) == 0:
        return 1
    else:
        return 0
profile
PLUS ULTRA

0개의 댓글