Algorithm · Snowflake · Medium
Write a function minimum_buses(trips) that returns the minimum number of buses required to serve every trip in a schedule. trips is an array of integer pairs [departure, arrival]. A bus cannot operate more than one trip simultaneously. After a bus finishes a trip at time t, it becomes available for any trip whose departure time is t or later; the trip's location does not matter and no turnaround delay is required. Each trip covers the half-open interval from departure up to…
Checking your access…