같은 숫자는 싫어

https://school.programmers.co.kr/learn/courses/30/lessons/12906

Explanation

I first thought since there are no duplicates allowed, we can use set but we have to preserve the order. So let’s use stack

from collections import deque
def solution(arr):
    stack =deque()
    for i in arr:
        if stack and stack[-1]==i:
            continue
        else:
            stack.append(i)
    return list(stack)