Solution: Organizing a Lottery

Solutions for the Points and Segments Problem.

Solution 1: Sorting all points

Consider an example with n=2n = 2 segments [l1,r1]=[4,10],[l2,r2]=[1,8][l_1,r_1] = [4,10], [l_2,r_2] = [1,8] and m=3m=3 points p1=11,p2=7,p3=3p_1 =11,p_2 =7,p_3 =3:

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