101. Minimum Railway Platforms
MediumGreedy
Train i arrives at arrivals[i] and leaves at departures[i] (times as integers such as 930 for 9:30, with arrival ≤ departure). A train occupies a platform from its arrival to its departure, inclusive, so a train arriving at the same time another leaves needs a different platform.
Return the minimum number of platforms so that no train waits.
Example 1
Input: arrivals = [900, 940, 950, 1100, 1500, 1800], departures = [910, 1200, 1120, 1130, 1900, 2000] Output: 3
Constraints
0 ≤ trains ≤ 5 · 10⁴