Design search autocomplete (typeahead)
As someone types into a search box, the box offers the most likely ways to finish the query: "ma" becomes "macbook air", "maxi dress", "mattress". It's a shop assistant who hears the first syllable and holds out the three things most customers ask for.
It's also asked as "design typeahead" or "design Google's search suggestions", and the move behind it is taught in Typeahead: prefix lookup and precomputed suggestions. Interviewers like it because every keystroke is a request, so the answer must be ready before anyone asks. The hard parts sit around the lookup: the build that ranks, the copies at the edge, and what's fresh. This page runs the marketplace from that pattern page as a full round, and its closest case study is Top-K and trending.
Below is a full mock interview following the seven steps of the framework. You're the candidate: at each Guess before you read on, stop and answer first.
Step 1 · Clarify the features and cut the scope
Minutes 0–5 · How this step works
Interviewer: Design autocomplete for our marketplace's search box.
You: A few questions first. What do we suggest: past queries, or products and shops?
Interviewer: Popular queries other people have searched.
You: How fresh must they be? Is an hour fine, or should a breaking search show up within minutes?
Interviewer: An hour is fine for most. A big launch should show within a few minutes.
You: The same suggestions for everyone, or personal?
Interviewer: The same for everyone, plus the user's own recent searches.
You: Which languages and markets? And must some phrases never appear?
Interviewer: One market to start, more later. Offensive phrases must go as soon as we're told.
You: Then I'll cover popular queries for one market rebuilt hourly, with launches within minutes. The user's own recent searches, a blocklist, web and phone are in too. Out: spelling correction, product pictures in the box, ranking per user, and ads. OK?
Interviewer: Good.
Each answer shapes the design: queries mean a table built from the query log, "an hour" means an hourly build, launches need a stream of recent counts, a shared list can sit at the edge, and the blocklist must reach every copy.