Back to problems

Compute maximum concurrent trips from intervals

Algorithm · Uber · Medium

You are handed a batch of half-open spans [start, end) measured in whole seconds, where each span satisfies start < end and marks a stretch of time during which some vehicle was occupied. Since the spans are half-open, one vehicle releasing at the exact second another is picked up counts as no overlap at all. Solve the three tasks below; they share the same input shape but differ in what must be reported and how much memory is allowed. Task A — peak occupancy and the first…

Checking your access…