Code Room
System designMediumsd-g348
Subject RelevanceLevel Mid–Senior~40 minCommon in Distributed systems interviewsIndustries Technology

Question

Design a query spell-correction system that decides whether to (a) auto-correct ('teh' → 'the'), (b) suggest 'did you mean X?', or (c) leave the query alone — and gets the *hard cases* right: real-word errors where the typo is itself a valid word ('form' vs. 'from', 'flour' vs. 'floor'), and brand/jargon that looks misspelled but is correct ('Hwawei', 'Pokémon', a product code). It runs on every search at scale. How do you model correction, and how do you avoid the embarrassing 'corrected a correct query' failures?

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.