title: "[프로그래머스] 덧칠하기 Python 파이썬 해설 (Level 1) - 이도훈"
cleanUrl: "programmers/161989"
description: "프로그래머스 Level 1 문제 [덧칠하기]의 풀이를 정리합니다."

문제 설명 및 제한사항

아이디어 및 해결 방법

코드

def solution(n, m, section):
    start, end = None, None
    cnt = 0
    for idx in section:
        if start is None or not (start <= idx < end):
            cnt += 1
            start, end = idx, idx + m

    return cnt

출처

프로그래머스 코딩테스트 연습 https://school.programmers.co.kr/learn/challenges