Merge Overlapping Collinear Segments | Applied Interview Question