본문 바로가기
Algorithm 💡/Implementation

[프로그래머스 Lv.1] 덧칠하기

by 킹우현 2024. 7. 15.

def solution(n, m, section):
    answer = 0
    
    painted = 0
    
    for s in section:
        if s > painted:
            painted = s+m-1
            answer += 1
        
    return answer