https://school.programmers.co.kr/learn/courses/30/lessons/42884
def solution(routes):
routes.sort()
cnt = 0
s,e = routes[0][0], routes[0][1] # -20, -15
for i in range(1, len(routes)):
i_s, i_e = routes[i][0], routes[i][1] # -18, -13 / -14, -5 / -5, -3
if i_s >= s and i_s <= e: # s <= n_s <= e --> 연결
s = max(s, i_s) # s = -20, e = -15 / s = -18, e = -15
e = min(e, i_e)
else:
cnt += 1
s, e = i_s, i_e # s = -14, e = -5 /
cnt += 1
return cnt
# [-20, -15] [-18, -13], [-14, -5], [-5,-3]