[Programmers] 같은 숫자는 싫어
Python
def solution(arr):
answer = []
for i in range(len(arr)):
if i == 0:
answer.append(arr[i])
elif arr[i] != arr[i-1]:
answer.append(arr[i])
return answer
def solution(arr):
answer = []
for i in range(len(arr)):
if i == 0:
answer.append(arr[i])
elif arr[i] != arr[i-1]:
answer.append(arr[i])
return answer
댓글남기기