Code Room
CodingMedium
Question
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]) → intExamples
in
[[900,940,950,1100,1500,1800],[910,1200,1120,1130,1900,2000]]out3What 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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.