Tries

Store words in a tree with one letter per edge, so words that share a prefix share a path. Reach for it when a problem involves prefixes, autocomplete or many words checked against a board, as in Implement Trie. Lookups cost the word's length, not the dictionary's size.

15 problems · 2 with a video · 3 to practice in an AI round

Tries problems
#ProblemDifficultyVideoAI round
1Longest Common PrefixEasy
2Word BreakMediumAI round
3Implement Trie (Prefix Tree)Medium—AI round
4Word Search IIHard—AI round
5Design Add and Search Words Data StructureMedium—
6Top K Frequent WordsMedium—
7Word Break IIHard—
8Maximum XOR of Two Numbers in an ArrayMedium—
9Number of Matching SubsequencesMedium—
10Search Suggestions SystemMedium—
11Lexicographical NumbersMedium—
12Design Search Autocomplete SystemHard—
13Remove Sub-Folders from the FilesystemMedium—
14Design In-Memory File SystemHard—
15Find the Length of the Longest Common PrefixMedium—

Practice in an AI round

Three of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.

Practice Word Break in an AI round