문제 프로그래머스 2단계 짝지어 제거하기
프로그래머스 2단계 짝지어 제거하기
스택을 사용하면 쉬운 문제!
def solution(s): stack = [] for x in s: stack.append(x) try: if stack[-1] == stack[-2]: stack.pop() stack.pop() except: continue if stack: return 0 else: return 1