aboutsummaryrefslogtreecommitdiff
path: root/challenge-050/orestis-zekai/python/ch-1.py
blob: 25693d3a49ec85121c4cf1b25dd39df411bce17e (plain)
1
2
3
4
5
6
7
8
9
10
11
inp = [[2,7], [3,9], [10,12], [15,19], [18,22]]


res = [inp[0]]
for interval in inp[1:]:
    if res[-1][1] >= interval[0]:
        res[-1][1] = max(res[-1][1], interval[1])
    else:
        res.append(interval)

print(res)