🎙 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 9 of 10

Why can arrivals and departures be sorted separately in the platforms problem?

Why can arrivals and departures be sorted separately in the platforms problem?

  1. A.Because every train arrives and leaves at the same time
  2. B.Because the input is always sorted
  3. C.Only the number of trains present matters, not which train is which
  4. D.Because departures are always later than all arrivals
Answer & explanation

Correct answer: Only the number of trains present matters, not which train is which

The count at any moment depends only on how many arrivals and departures happened before it.

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 →