I search algorithm, that will help me in the realization of a problem! The problem is as follows:
There is a list of ranges, I need to build a list with a subset of non-overlapping ranges (not necessarily adjacent), such that the sum of their lengths is maximum possible.
For example, for an input list
[(-1, 3), (2, 4), (0, 5), (-4, -1)]
the desired output is
[(0, 5), (-4, -1)]
with the sum of lengths (5 - 0) + ((-1) - (-4)) = 5 + 3 = 8