I started with the data pipeline and routing logic which felt safe, but the interviewer kept pushing toward how you'd actually keep estimates accurate in real time.
Start by clarifying the scope: ETA for a maps app involves predicting travel time along a route, considering real-time and historical data. Then, outline a high-level system that ingests traffic data, computes ETAs using models, and serves them at scale with low latency. Finally, discuss trade-offs between accuracy, latency, and cost, and how to handle edge cases like accidents or road closures.
Pro tip: Emphasize the importance of a feedback loop: continuously compare predicted ETAs with actual arrival times to retrain models and improve accuracy. This shows you think about long-term system health, not just initial design.
Ask about scale (users, requests per second), latency requirements, accuracy targets, and data sources (e.g., GPS probes, traffic APIs). Also clarify if it's for a single route or multiple alternatives.
Outline components: data ingestion (real-time traffic, historical), ETA computation service (routing engine + traffic model), and serving layer (API with caching). Mention using a graph representation of roads and partitioning for scalability.
Explain how to compute ETA: break route into segments, estimate speed per segment using historical and real-time data, sum times. Discuss models: simple average, machine learning (e.g., gradient boosting) using features like time of day, weather, road type.
Address how to handle millions of requests: precompute ETAs for popular routes, use in-memory caches (e.g., Redis), and distribute computation geographically. Consider trade-off between precomputation and on-the-fly calculation.
Discuss trade-offs: accuracy vs. latency, cost of real-time data vs. historical. Suggest improvements: incorporate user feedback, handle anomalies (accidents) via real-time updates, and use ensemble models.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.