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
Data Manipulation (SQL/Python)
Data Scientist
Zoox
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

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
window functions
percentiles
survivorship bias
time bucketing
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 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions