Minimum Platforms
Learn Minimum Platforms (Greedy Algorithms, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
How Many Platforms Does a Railway Station Need? Given trains' arrival and departure times, find the MINIMUM number of platforms needed so no two overlapping trains ever need the same platform. Greedy approach: sort arrivals and departures SEPARATELY, then sweep through in time order - a platform is needed whenever an arrival happens, freed whenever a departure happens (using two pointers).