Code RoomNearby drivers query
HardPrep Room Coding #3521

Nearby drivers query

System designDatabases & SQLSenior–Staff~50 min

Design a 'nearby drivers' query service where both the queried set (drivers) and the queriers (riders) are constantly moving. A rider opening the app needs the ~20 nearest available drivers, ranked by ETA not raw distance, returned in <50ms, while 300k drivers update their location every 4 seconds. Unlike a static POI search, the index is being rewritten constantly. Describe the dynamic spatial index, how you serve k-NN under continuous churn, how you rank by ETA, and the consistency trade-off between index freshness and query latency.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify5:30 left
Estimate5:30 planned
Design16:30 planned
Deep dive13:30 planned
Failure9:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.