Algorithm · Applied Intuition · Hard
You are given a collection of 2D line segments. Each segment is represented by two or more points. When a segment contains more than two points, those points are guaranteed to lie on the same straight line. Two segments can be merged into a single segment if they satisfy both of the following conditions: They are collinear (they lie on the same infinite line). They intersect (their projections onto the common line overlap, including touching at endpoints). Your task is to…
Checking your access…