Minimum Number of Platforms

Problem

Given train arrival and departure times, find the minimum number of platforms needed so that no train has to wait.

Input / Output

  • Input: arrays arr (arrival times) and dep (departure times) for n trains.
  • Output: the minimum number of platforms required.

Constraints

  • 1 ≤ n ≤ 10^5
  • A train arriving exactly when another departs is handled per the interviewer's convention (clarify).

Example

arr=[900,940,950,1100], dep=[910,1200,1120,1130] -> 3
added …
LeaderboardSalaryAccount