← Questions
Minimum buses to run a timetable
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A bus depot has a timetable of trips, each with a departure time and an arrival time. A bus can take a new trip once it has arrived from its previous one. Return the fewest buses needed to run every trip (a meeting-rooms style problem).
Follow-up: each trip now also has a departure station and an arrival station, and a bus can only take a trip that leaves from the station where it currently is. Find the fewest buses again. Aim for a heap-based solution rather than scanning every bus.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
