Compute Hourly Pickup Wait Percentiles for Robotaxi Requests
Last updated: November 29, 2026
Quick Overview
Using a table of ride requests with request time, vehicle arrival time and status, report for each hour of day the completed pickup count, p50 and p90 wait in minutes, and the rider cancellation rate.
Zoox
November 29, 20260
0
0 solved
Using a table of ride requests with request time, vehicle arrival time and status, report for each hour of day the completed pickup count, p50 and p90 wait in minutes, and the rider cancellation rate.
Zoox runs a public robotaxi service, and wait time by hour is one of the first metrics operations and fleet planning teams look at when deciding how many vehicles to stage. The interviewer checks percentile logic in SQL, correct filtering of incomplete rides, and whether the candidate keeps cancellations in the denominator.
What the Interviewer Expects
- Filters waits to completed rides with a valid arrival time
- Computes percentiles with a window function or PERCENTILE_CONT and explains the definition
- Computes cancellation rate over all requests, not only completed ones
- Groups by local hour and mentions time zone handling
- Sanity checks the output against raw counts
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you break this down by pickup zone and day of week?
- Why might p90 wait look better when cancellations rise?
- How would you handle requests that span midnight or DST changes?
- What would you plot for an operations review?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table ride_requests(request_id, requested_at, arrived_at, status), timestamps stored in local Las Vegas time (if UTC, convert first). status values include completed and rider_canceled. Wait i...
Approach
Build a waits CTE for completed rides, rank waits inside each hour with ROW_NUMBER and a partition count, and take the nearest-rank percentile (first row whose rank reaches ceil(p * n)). Compute...