Code RoomTrain platform minimum count
MediumPrep Room Coding #1093

Train platform minimum count

CodingAlgorithms & data structuresMid–Senior~20 min

Given arrival and departure times of trains at a station (arrivals[i] and departures[i] belong to train i, arrival <= departure), return the minimum number of platforms needed so that no train waits. A platform freed at the exact departure time may be reused by a train arriving at that same time. Both lists have equal length and may be empty.

Implement
min_platforms(arrivals: list[int], departures: list[int]) → int
Examples
in[[900,940,950,1100,1500,1800],[910,1200,1120,1130,1900,2000]]out3
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 20 min
InputExpectedGot
[[900,940,950,1100,1500,1800],[910,1200,1120,1130,1900,2000]]3not run yetsample