Skip to content

ONE QUESTION. YOUR REASONING.

Design search autocomplete

Design autocomplete for a search box: as someone types, show the five most popular searches that start with what they have typed.

System designSearch and autocompleteMid-levelSenior

YOUR BRIEF

What to work through

Work through search autocomplete as a spoken system design interview. Start by clarifying the scope, sketch a working design and explain the trade-offs behind your choices.

  • Return the top 5 suggestions for the prefix typed so far
  • Rank suggestions by how often each query was searched
  • Match only the start of a query; no spell check
  • Keep suggestions current as new queries come in
  • Never suggest offensive or unwanted queries

BEFORE YOU START

Constraints to discuss

  • Suggestions show within 100 ms
  • 10 million daily users, 24,000 requests a second on average
  • Highly available
  • English, lowercase, no special characters
Need a starting point?

Watch for these common gaps as you prepare:

  • Counting searches, not keystrokes, and sizing the service for 1,200 requests a second
  • Walking the whole subtree and sorting on every keystroke
  • Updating the trie on every search, on the request path
  • Sharding by alphabet ranges as if letters were equally common
  • No way to remove an offensive suggestion quickly
Read: System design questions and who asks them

Why this question is in the collection

These sources connect the problem to company interview reports or preparation guides. They do not guarantee what a company will ask you.

KEEP GOING

Your next question

Storage, files and linksDesign BitlyInfrastructure and platformDesign a rate limiterInfrastructure and platformDesign an A/B testing platformInfrastructure and platformDesign an ad click aggregator
Browse the collection
01

Pick a question

Read the brief and choose what you want to work on.

02

Talk it through

Explain your thinking. Respond to follow-ups. Draw when a design needs it.

03

Find your next improvement

Use the feedback from your interview to decide what to practise next.