Question bank › Trie
Dsa Trie Warm-up

Spell Checker with Suggestions

You are building a basic spell checker that can suggest corrections for misspelled words. Implement a trie-based structure that can insert words and suggest corrections for a given misspelled word by finding all words that are one character change away. The input is a sequence of commands: 1. 'ADD <word>' - Add a word to the trie. 2. 'SUGGEST <word>' - Suggest words that are one character change away from the given word. The output should be the list of suggestions for each 'SUGGEST' command, sorted in alphabetical order. Example: INPUT: ADD cat ADD cab ADD bat SUGGEST dat SUGGEST cab OUTPUT: bat cab

Key concepts

triespell-checksuggestions

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.