~/boss / spell-book

Trie (prefix tree)

The Spell Book

Type three letters and it already knows your word. Teach it how.

Loading the fight…

How to beat it

Store words letter by letter: words that start the same share a branch. Walk down the letters that are already there, grow the ones that aren't, and star the letter where a word ends. To guess, walk the typed letters: every star below you is a suggestion.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/implement-trie-prefix-tree there. Sign in with your email to keep your progress on every device.

More bosses

esc