Dsa
Trie
Medium
Spell Checker
Create a spell checker that uses a Trie to verify if a list of input words is correctly spelled based on a reference dictionary.
Input:
- The first line contains an integer d, the number of dictionary words.
- The next d lines contain one dictionary word each.
- The following line contains an integer w, the number of words to check.
- The next w lines contain one word each (with possible typos).
Output:
- For each word that is not found in the dictionary, print 'Incorrect'.
- If the word is in the dictionary, print 'Correct'.
Example:
Input:
3
the
quick
brown
4
the
quit
brawn
brown
Output:
Correct
Incorrect
Incorrect
Correct
Key concepts
triestringvalidation
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