def solution(arr):
now = -1
answer = []
for num in arr:
if now == -1:
now = num
answer.append(num)
elif now == num:
continue
elif now != num:
now = num
answer.append(num)
return answer
스택/큐 종류의 문제란 것을 모르고 풀었는데, 지금 보니 맞다.
그 이유는 기억해야 할 데이터가 스택의 가장 앞에 있는 top이었기 때문이다.
중복 제거는 스택을 사용할 수 있다는 것을 기억하자!