스택/큐(Lv.01) 같은 숫자는 싫어 👾
https://school.programmers.co.kr/learn/courses/30/lessons/12906
def solution(arr):
answer = []
for i in range(len(arr)-1):
if arr[i]!=arr[i+1]:
answer.append(arr[i])
answer.append(arr[len(arr)-1])
return answer
def no_continuous(s):
result = []
#문자열 안의 모든 문자를 돌면서
#result에 들어있는 문자가 없거나
#result의 마지막 문자가 현재 문자와 같지 않다면
#result에 현재 문자를 더해준다
for c in s:
if len(result) == 0 or result[-1] != c:
result.append(c)
return result