Code RoomQuery spell correction
MediumPrep Room Coding #3467

Query spell correction

System designDistributed systemsMid–Senior~40 min

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.

Clarify4:30 left
Estimate4:30 planned
Design13:30 planned
Deep dive10:30 planned
Failure7:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.