We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
A trie stores strings by shared prefix so a lookup costs the length of the word rather than the size of the dictionary. It is the right structure for autocomplete, prefix matching, and pruning a grid word-search that would otherwise explode. Interviewers usually ask you to implement one before they ask you to use one.
Many words, repeated prefix queries, autocomplete, or word-search over a grid.
8 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.