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

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

 

def solution(arr):
    answer = [arr[0]]
    
    for i in range(1, len(arr)):
        if arr[i] != answer[-1]:
            answer.append(arr[i])
    return answer

 

It wasn’t easy... Sometimes the basics are the hardest to figure out. I solved it back in February, but it was so tough. Let’s stick to the basics!

 

 

 

 

+ Recent posts