Peak Number of Dashers on Simultaneous Active Deliveries

Last updated: November 29, 2026

Quick Overview

Given deliveries as (pickup_time, dropoff_time) half-open intervals, return the maximum number of deliveries in progress at the same moment and the earliest time that peak is reached.

DoorDash
Coding & Algorithms
Software Engineer
DoorDash
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given deliveries as (pickup_time, dropoff_time) half-open intervals, return the maximum number of deliveries in progress at the same moment and the earliest time that peak is reached.

Capacity planning for Dasher supply is central to DoorDash, and this sweep line question mirrors how ops teams look at concurrent active deliveries per market. Interviewers look for event sorting with the correct ordering at equal timestamps and a clear statement of interval semantics.

What the Interviewer Expects
  • State the half-open interval convention explicitly
  • Turn intervals into +1 and -1 events
  • Sort so a dropoff at t is processed before a pickup at t
  • Track the time the peak is first reached
  • Mention the heap alternative and why the sweep is simpler
Key Topics to Cover
sweep line
intervals
event sorting
capacity planning
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you return the full timeline of concurrency for a chart?
  • How would you compute the peak per zone when deliveries cross zones?
  • What if intervals stream in and you need a rolling peak over the last hour?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: list of (pickup, dropoff) integer timestamps.
  • A delivery is active on [pickup, dropoff), so back-to-back deliveries by one Dasher do not double count.
  • Output: (peak, first_time); `(...
High-Level Design

Create an event (t, +1) for each pickup and (t, -1) for each dropoff. Sort by time, and at equal times put -1 before +1 (sorting by the delta does this since -1 < 1). Sweep, keeping the runnin...


Submit Your Answer
Markdown supported