Design Nearby Search for Autonomous Vehicles
Company: Zoox
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
Design a nearby-search system for autonomous vehicles. A query supplies a location and search criteria, and the system returns nearby vehicles that currently satisfy those criteria.
### Constraints & Assumptions
- Vehicle locations change continuously and may arrive late or out of order.
- Queries need a consistent definition of "nearby," such as a radius or top `k` by distance.
- A temporarily stale location is possible and must be visible in the result metadata.
- The exercise does not prescribe map geometry, fleet size, or a latency target; state the assumptions that drive your design.
### Clarifying Questions to Ask
- Is distance straight-line, road-network travel distance, or predicted travel time?
- Which vehicle attributes filter eligibility?
- How stale may a location be before the vehicle is excluded?
- Do queries need a snapshot, or is eventual consistency acceptable?
- What are the update and query rates by region?
### What a Strong Answer Covers
- Location ingestion, ordering, and last-known-state storage
- Spatial partitioning and candidate retrieval
- Precise filtering and distance refinement
- Hot-region handling and repartitioning
- Staleness, failure recovery, and observability
- Privacy and authorization boundaries for vehicle data
### Follow-up Questions
- How would predicted travel time replace geometric distance?
- How would you handle a stadium-scale hotspot?
- How would a vehicle removal race with a nearby query?
Quick Answer: Design a nearby-search service that filters continuously moving autonomous vehicles by location and eligibility criteria. Address late and out-of-order updates, distance semantics, stale-result metadata, hot regions, consistency, privacy, authorization, failover, and the assumptions behind scale and latency choices.