Here is the problem I'm trying to solve. Help me please to find a solution.
There are some segments that have start and end point on coordinate line. Each time we can eliminate one pair of intersecting segments.
The problem: how to maximize the count of eliminated segments?
Each time we removing one pair we might break another one. If one segment is intersecting several another segments, how to select the right one to eliminate as pair with former?
Example of elimination process:
8 segments was removed