← Back to TypeScript
Tries and Prefixes
A tree keyed by characters, where every word is a path — autocomplete, prefix lookup, and the wildcard search that walks every branch at once.
Insert and search in a trie
advancedblankComplete the character tree's two operations — the child map each node holds, the write that links a new branch, and the flag that says a word ends here.
Challenge: autocomplete on a trie
advancedchallengeReturn every word that extends a prefix, in dictionary order — walk to the prefix node, then collect every word beneath it.
Challenge: search with a wildcard
expertchallengeSupport queries where a dot matches any single character — the trie search that fans out across every branch when it must.
Review: the prefix that answers as a word
advancedreviewA trie lookup returns true for every prefix of every indexed word — the path exists, so the search says found. One missing check.