Data Structures & AlgorithmsModerateProduct Company SDE · sweep line

Problem: Which technique gives the answer to 'minimum number of platforms' by sorting events?

  1. A. Sweep line over sorted arrival and departure times
  2. B. Dijkstra's algorithm
  3. C. Gale-Shapley
  4. D. Prim's algorithm

Correct answer: A. Sweep line over sorted arrival and departure times

Sorting events and scanning with a counter gives the peak overlap as the answer.

More Coding Interview Problems questions

Exams that ask this topic