🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Interval Problems: all 10 questions

Quiz: Interval Problems · Question 2 of 10

Why must intervals be sorted by start before merging?

Why must intervals be sorted by start before merging?

  1. A.Sorting removes duplicates
  2. B.Python requires sorted lists
  3. C.After sorting, a new interval can only overlap the last merged block, so one pass is enough
  4. D.It makes every interval the same length
Answer & explanation

Correct answer: After sorting, a new interval can only overlap the last merged block, so one pass is enough

Without sorting, an interval could overlap a block built much earlier.

Can you get the rest right without peeking?

Take the timed Quiz: Interval Problems quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →