Skip to content

Tries

A trie (prefix tree) stores words letter by letter, so words that start the same share a path — like a phone's autocomplete. Any "starts with…" question becomes a short walk down the tree.

After this topic: You can build a trie, add wildcard search, and prune a search over a grid with it.

Do these first: Trees

0 of 3 solved0%

Step 1 · Read the lesson

Tries

Store words letter by letter so any prefix question is a short walk down a tree.

Step 2 · Solve the problems in order

Try each one for about 20 minutes first. Problems with a Run code tab are checked right here. If you are stuck, open Nudge, think again, then Idea. Go skeleton only gives the function shape, and Reference solution is for comparing after you have tried. Tick the box when you could solve it again without help.

  1. 1.Implement Trie (Prefix Tree)Medium
  2. 2.Design Add and Search WordsMedium
  3. 3.Word Search IIHard