Merge 2D Line Segments

Asked at Applied Intuition · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

Given a set of 2D line segments (represented by two or more points, and if more than two points, they are guaranteed to be collinear), merge all segments that can be merged. Segments can be merged if they are collinear and intersecting.

Loading the problem…