• Skip to primary navigation
  • Skip to content
  • Skip to footer
Sponge Note Sponge Note Do It
  • Home
  • Search
    1. Home
    2. /
    3. Algorithm
    4. /
    5. [프로그래머스] 덧칠하기

    Hyse

    기록하고 활용하자

    • South Korea
    • GitHub
    • 이메일
    • 📂 전체 글 수 139 개
    • About
    • Study
      • JPA 기초 (9)
      • JPA 활용 (6)
      • SpringDataJPA (5)
      • QueryDsl (5)
      • AWS (5)
      • Docker (2)
      • Security (1)
      • Spring (2)
      • RDBMS (1)
      • Network (1)
      • MSA (1)
      Algorithm
      • 알고리즘(91)
    정보처리기사
    • 정보처리기사(10)

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

    September 17, 2023 less than 1 minute read

    On This Page

    • 파이썬

    문제링크

    반복문 for 사용

    section[i]에서 - paint 값이 m보다 크다면

    answer +=1

    파이썬

    def solution(n, m, section):
        answer = 1 
        paint = section[0]
        
        for i in range(1, len(section)):
            if section[i] - paint >= m:
                answer += 1
                paint = section[i]
                
        return answer
    
    

    카테고리: Algorithm

    업데이트: September 17, 2023

    공유하기

    Twitter Facebook LinkedIn
    이전 다음

    댓글남기기

    참고

    2023.09.15

    [프로그래머스] 최소직사각형

    2023.09.13

    REST, REST API, RESTful?

    2023.09.11

    [백준] 10799번 쇠막대기

    2023.09.07

    [백준] 2776번 암기왕

    • 팔로우:
    • GitHub
    • Feed
    © 2024 Hyse. Powered by Jekyll & Minimal Mistakes.