I'm now working on a problem I can't find a name for, so googling anything is like impossible, therefore I try to describe it here.
Imagine we got a range or some main line on paper. Now we got many smaller lines with randomly variable lengths, plus they have specified at what range they starts. I need to choose a set of these smaller lines, so the spaces together, where we can see the main line, will be lowest possible. So generaly we are trying to cover the main line with smaller chunks that have defined position and length most efficiently.
Other than answer on how to perform this task I'd be glad to know the name of this problem, as I'm sure this is quite common when programming and can be also generalized to more dimensions than one..
As thiton reminded me, ni overlaps are allowed (ofcourse, it would be quite nonsense otherway)
This looks like dynamic programming to me. First of all, sort the intervals so that you can deal with them in non-decreasing order of rightmost point. Now we try and find, for each x, the best way to cover the points <= x. When we pick up a new interval ending at T, we will end up with a cover for points <= T, and the best one comes by looking through the solutions we have so far to find the best solution for points <= S, where S is the largest S <= the left point of our new interval. You can make it reasonably quick to find this best match by storing solutions so far in a sorted collection, like a red/black tree.
Once you have dealt with all of your intervals, you can look through all of the best solutions, accounting for the fact that some of them will end before the end of your line, and pick the overall winner.