title: "[프로그래머스] 겹치는 선분의 길이 Python 파이썬 해설 (Level 0) - 이도훈"
cleanUrl: "programmers/120876"
description: "프로그래머스 Level 0 문제 [겹치는 선분의 길이]의 풀이를 정리합니다."

문제 설명 및 제한사항

아이디어 및 해결 방법

코드

def solution(lines):
    covered_points = [set(list(range(x, y))) for x, y in lines]
    
    cnt = 0
    for i in range(-100, 101):
        if sum(i in points for points in covered_points) > 1:
            cnt += 1
            
    return cnt

출처

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