01What does the user get on each keystroke?
Up to 10 ranked completions for the current prefix, rendered fast enough to feel attached to the keystroke.
Premium preview
Design the autocomplete/typeahead system behind a search bar that returns the top-K query suggestions for a partial prefix within a sub-50ms budget, at the scale of a major search engine.
The requirements are open as a taste. From the numbers onward, the full guide opens in the app.
Do not only state requirements. Ask for them. Each card pairs the design constraint with a clarification question you can say out loud before drawing the architecture.
01What does the user get on each keystroke?
Up to 10 ranked completions for the current prefix, rendered fast enough to feel attached to the keystroke.
02Ranked by what — global popularity, my own history, or both?
A blend: global popularity forms the base list, and the user’s own recent queries are layered on top of it.
03A term explodes in the news — when does it show up in suggestions?
Within minutes to a couple of hours — a trending path boosts sudden risers ahead of the next scheduled rebuild.
04One language, or every script users actually type?
Multi-language and full unicode: prefixes are normalized, and each language/region gets its own suggestion set.
05Can an offensive term ever appear as a suggestion?
No — a blocklist filter runs at serve time on every response, so nothing filtered can leak through any caller.
06Does every single keystroke really fire a network request?
No — the client debounces short pauses and cancels stale in-flight responses; the server contract stays a stateless prefix → top-K lookup.
Out of scopeRanking the full results page (this is the box above the results, not the results) · Did-you-mean spell correction of the submitted query on the results page · Sponsored suggestions and the ad auction behind them
01What latency budget do we actually have per keystroke?
p99 under 50 ms end to end — after network transit that leaves ~10 ms of server time, so the answer must already exist before the keystroke arrives.
02How much traffic is this compared to search itself?
Every keystroke is a query: suggest traffic is search QPS × average typed length, roughly 8×, and the tier is sized for that amplification.
03Stale suggestions or no suggestions — which failure is worse?
No suggestions is worse than stale suggestions: on any backend trouble, serve the last cached list — suggestions are a hint, not a source of truth.
04Is load spread evenly across prefixes?
Traffic is wildly skewed toward short prefixes — hot keys must be absorbed by replication and edge caching, never funneled onto one shard.
05How fresh does the suggestion set have to be?
Two freshness tiers: the global table may lag hours behind the logs, but a breaking term must enter within minutes.
Real interviews probe far more than a tidy list. These are the scope questions that separate candidates who interrogate the problem from those who recite it.
Numbers, architecture diagram, API and data model, deep dives, expected topics, self-check, whiteboard starter, and common mistakes unlock inside the app.
Locked in the app
Locked in the app
Locked in the app
Locked in the app