def solution(line):
answer = 0
count = [0 for _ in range(200)]
for l in line:
for i in range(l[0], l[1]):
count[i + 100] += 1
answer += count.count(2)
answer += count.count(3)
return answer
첫 번째 솔루션
def solution(line):
sets = [set(range(min(l), max(l))) for l in line]
return len(sets[0] & sets[1] | sets[0] & sets[2] | sets[1] & sets[2])
두 번째 솔루션
후기