def solution(arr):
answer = []
check_pt = arr[0]
answer.append(check_pt)
for i in range(1, len(arr)):
if check_pt != arr[i]:
check_pt = arr[i]
answer.append(check_pt)
return answer
'✨ 공부 기록 > 알고리즘' 카테고리의 다른 글
[프로그래머스 lv 3] 네트워크(깊이/너비 우선 탐색(DFS/BFS)) (0) | 2025.02.26 |
---|---|
[프로그래머스 lv 2] 타겟 넘버(깊이/너비 우선 탐색(DFS/BFS)) (0) | 2025.02.26 |
[프로그래머스 lv 0] 컨트롤 제트 (0) | 2025.02.25 |
[프로그래머스 lv 1] 과일 장수 (0) | 2025.02.25 |
[프로그래머스 lv 2] 오픈채팅방 (0) | 2025.02.25 |