10. Union of intervals

Deadline: 2022-04-27 24:00

Given \(N\) closed intervals \([A_1, B_1], [A_2, B_2], \ldots [A_N, B_N]\), where \(A_i\) and \(B_i\) are natural numbers. We want to dermine the total length of the intervals, precisely the measure of the domain \[\bigcup_{i = 1}^N [A_i, B_i].\]

We provide an example program interval.py that reads the intervals from the file named in the command line argument.