19 Wed

์—ฐ์†๋œ ์ˆ˜ ์ œ๊ฑฐํ•˜๊ธฐ

'''
https://programmers.co.kr/learn/courses/30/lessons/12906
์—ฐ์†๋œ ์ˆ˜ ์ œ๊ฑฐํ•˜๊ธฐ
[ํ’€์ด]
1. ์•ž์ž๋ฆฌ ์ˆ˜์™€ ๋น„๊ตํ•ด์„œ ์ œ๊ฑฐํ•ด๊ฐ
'''
def solution(arr):
    answer = []
    temp = arr[0]
    for i in arr[1:]:
        if temp != i:
            answer.append(temp)
        temp = i
    answer.append(temp)
    return answer
'''
๋ฐฐ์šธ์ ์ด ์žˆ๋Š” ์ฝ”๋“œ ๋‹ค๋ฅธ์‚ฌ๋žŒ ์ฝ”๋“œ
def no_continuous(s):
    a = []
    for i in s:
        if a[-1:] == [i]: continue
        a.append(i)
    return a
'''

Last updated

Was this helpful?