Challenge: Collecting Signatures

Solve the Collecting Signatures Problem.

We'll cover the following

Problem


This problem is similar to the Covering Segments by Points Problem.

Covering Segments by Points

Find the minimum number of points needed to cover all given segments on a line.

Input: A sequence of nn segments [l1,r1],...,[ln,rn][l_{1} , r_{1} ],...,[l_{n}, r_{n}] on a line.
Output: A set of points of minimum size such that each segment [li,ri][l_{i}, r_{i}] contains a point, i.e., there exists a point xx from this set such that lixril_{i} ≤ x ≤ r_{i}.


Level up your interview prep. Join Educative to access 80+ hands-on prep courses.