Dasher Shift Utilization from Overlapping Stacked Delivery Intervals

Last updated: November 29, 2026

Quick Overview

Given each Dasher's dash shifts and the pickup-to-dropoff intervals of their deliveries (which overlap when orders are stacked), use pandas to compute busy minutes as the union of delivery intervals clipped to the shift, and utilization as busy minutes over online minutes.

DoorDash
Data Manipulation (SQL/Python)
Data Scientist
DoorDash
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Hard

0

0

0 solved


Given each Dasher's dash shifts and the pickup-to-dropoff intervals of their deliveries (which overlap when orders are stacked), use pandas to compute busy minutes as the union of delivery intervals clipped to the shift, and utilization as busy minutes over online minutes.

DoorDash batches multiple orders onto one Dasher, so simply summing delivery durations double counts time and can push utilization above 100%. Logistics DS onsites use this to test interval merging in pandas, clipping to a window, and keeping shifts with no deliveries in the denominator.

What the Interviewer Expects
  • Recognize that stacked deliveries overlap and summing durations overcounts
  • Clip each delivery interval to its shift before merging
  • Merge overlapping intervals with a running max of end times, vectorized per group
  • Keep zero-delivery shifts with zero busy time via a left merge
  • Validate that utilization lies between 0 and 1
Key Topics to Cover
interval merging
pandas groupby
cummax
clipping
utilization
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you split busy time into 'carrying one order' versus 'carrying two or more'?
  • How would you compute this in SQL?
  • Should time driving to the store before pickup count as busy? How would the definition change the metric?
  • How would you aggregate utilization to a market level: average of ratios or ratio of sums?
Sharpen Your Skills on Codemia

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

Practice SQL Problems
Sample Answer
Clarify the Data

shifts(dasher_id, shift_id, shift_start, shift_end) and deliveries(dasher_id, shift_id, start_ts, end_ts) where start is pickup and end is dropoff. A delivery can begin slightly before the logged ...

Approach

Sort deliveries by shift and start time. For each row compute the maximum end time among all earlier rows in the shift (cummax().shift()). If the current start is after that running max, it starts...


Submit Your Answer
Markdown supported