</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 12: New Candidates, Same Merge - Follow-up Feature Evolution

Executive Summary: The interviewer stops attacking and starts asking for more: typo tolerance, rich entity suggestions, suggestions before the user types, learned ranking, real personalization, a bigger index, and the same system for a store or a people directory. Most of these land as a new candidate generator feeding Section 9's query-time merge, or as a new value of the type field Section 4 already put in the response. The rest are flip triggers named in advance (D2, D3, D5, D8) finally firing, while the trie, the snapshot swap and the no-identity cache key stay put.

The interviewer leans back. "It's live. A billion people use it. Product now wants typo tolerance, a card when you type an event name, suggestions the moment the box gets focus, and a ranking team that wants to use machine learning. Evolve it."

Two ways to fail: discovering the trie was the whole system and must be torn down, or claiming you'd quietly built all of this already. The interviewer wants each feature arriving through a door the design left open.

Key Insight: The serving node already does one general thing: collect candidates from several sources, dedupe, filter through the blocklist, score, take ten. Section 9 built it for two sources. Any feature that is just another source of candidates inherits the dedupe, the blocklist and the cacheability.

Typeahead serving path (client, CDN cache, suggestion service, trie, trending delta, blocklist) with five dashed doors where fuzzy matching, entity cards, empty-prefix suggestions, a re-rank tier and locale sharding plug in

Fuzzy Matching: A Third Generator

You: "Maya fat-fingers chicgo mara. The trie walk dies at chicg: no such path. I'd add a fuzzy generator that runs only when the exact walk finds fewer than ten completions, and tries edit-distance-1 variants of the prefix against the same trie."

Interviewer: "Edit distance on every keystroke? That's a lot of walks."

You: "It is. An 11-character prefix like chicgo mara has about 600 distance-1 variants (Section 10), so the generator gets a hard budget inside the origin's 10 ms p99 (N14). It stops after a fixed number of node visits. Corrected candidates come back with type: "correction" so the client can label them. If the budget can't hold, a separate spelling service merges in the same way."

What stays: the trie, the snapshot and the cache key, because a corrected response still depends on the prefix alone.

Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.