Find Sustained Undersupplied Windows per Submarket in 15-Minute Buckets

Last updated: November 29, 2026

Quick Overview

Using Dasher online sessions and order creation times, compute time-weighted active Dashers and orders per submarket in 15-minute buckets for one day, then return every run of at least three consecutive buckets where orders exceed 1.5 times effective supply.

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

0

0

0 solved


Using Dasher online sessions and order creation times, compute time-weighted active Dashers and orders per submarket in 15-minute buckets for one day, then return every run of at least three consecutive buckets where orders exceed 1.5 times effective supply.

DoorDash runs a two-sided marketplace by submarket and uses supply and demand health to decide when to turn on Peak Pay or slow down demand. This Hard onsite question combines interval overlap math, a dense time spine, and gaps and islands, and the interviewer is checking whether you measure supply as Dasher time rather than a head count.

What the Interviewer Expects
  • Measure supply as Dasher-minutes overlapping each bucket divided by bucket length
  • Handle sessions with no offline time (still online)
  • Build a submarket by bucket grid so empty buckets are explicit
  • Treat orders with zero supply as undersupplied rather than dividing by zero
  • Use bucket index minus ROW_NUMBER to find consecutive runs
Key Topics to Cover
interval overlap
time buckets
gaps and islands
marketplace health
generate_series
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 use 'Dashers idle and available' instead of 'online' as supply, and what data would you need?
  • Should demand be orders created or orders waiting for assignment in the bucket? Which better reflects pressure?
  • How would you make the 1.5 threshold submarket specific?
  • How would you scale this to a month of data across thousands of submarkets?
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

dasher_sessions(dasher_id, submarket_id, online_at, offline_at) where offline_at is null if the Dasher is still online; orders(order_id, submarket_id, created_at); submarkets(submarket_id). On...

Approach
  1. Bucket spine with an ordinal index. 2) Supply: join each session to every bucket it overlaps (start before bucket end, end after bucket start) and sum the clipped overlap in seconds over 900. 3) De...

Submit Your Answer
Markdown supported