10 worked problems

Trie

Prefix trees for words and bits. Many words or bit strings share prefixes and queries repeatedly walk those prefixes.

Recognition signal

When should you think of Trie?

Many words or bit strings share prefixes and queries repeatedly walk those prefixes.

Core invariant

What must stay true?

The current trie node represents the exact prefix consumed so far.

Practice in a deliberate order

What to learn in this cluster

  1. 01Insert and prefix lookup
  2. 02Wildcard and board search
  3. 03Bitwise tries for maximum XOR

All Trie problems

10 of 10 walkthroughs
Continue the cluster

Related patterns and study guides