Your question is Simultaneous Trips in 24 Hours. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Via Transportation needs to identify the busiest period in its On-Demand trip schedule. Given trips scheduled within one 24-hour day, determine the maximum number of trips active simultaneously and the earliest minute at which that maximum occurs.
A trip is active on the half-open interval [start, end): it includes start but excludes end. Therefore, a trip ending at minute t does not overlap with a trip starting at minute t.
Implement max_simultaneous_trips(trips), where trips is a list of pairs [start, end]. Each value is an integer minute from midnight, with 0 <= start < end <= 1440. Return [peak_count, earliest_start], where peak_count is the largest number of simultaneous trips and earliest_start is the smallest minute at which that count is active. Return [0, 0] when the list is empty.
def max_simultaneous_trips(trips):