Skip to content

Trie problems,
and the tell.

The question is about prefixes: autocomplete, words starting with, or matching many patterns at once. 41 problems in the catalogue carry this tag, from first-week easy to interview hard.

Free to start. Running and submitting a solution never costs credits.

How the pattern actually works.

One mechanism, and the mistake that costs people the problem.

The tell. The question is about prefixes: autocomplete, words starting with, or matching many patterns at once.

The mechanism. Each node is one character and each word is a path from the root. Insert, search and prefix search all cost the length of the word, whatever else is stored.

What goes wrong. Memory. A node per character per branch adds up fast, and a map per node is far heavier than a fixed array when the alphabet is small.

The ones asked most often.

By how often the catalogue records them being set, not by our opinion.

  1. Number of Distinct Substrings in a StringMediumasked at 3 companies
  2. Maximum XOR of Two Non-Overlapping SubtreesHardasked at 2 companies
  3. Encrypt and Decrypt StringsHardasked at 1 companies
  4. Count Pairs With XOR in a RangeHardasked at 1 companies
  5. Maximum Strong Pair XOR IEasyasked at 1 companies
  6. Maximum Strong Pair XOR IIHardasked at 1 companies
  7. Word BreakMediumasked at 25 companies
  8. Design In-Memory File SystemHardasked at 9 companies
  9. Map Sum PairsMediumasked at 1 companies
  10. Count Prefix and Suffix Pairs IIHardasked at 3 companies

Read it, watch it, then solve it.

The order that makes a pattern stick.

Everything in the app, in one place.

Practice, interviews and the tools, all free to start. Swipe to see the rest.

Free to start: 100 AI credits when you sign up and 100 every month. Start free in the app

About trie problems.

Free to start, no card.

Start practising
How do I know a problem is a trie problem?

The question is about prefixes: autocomplete, words starting with, or matching many patterns at once.

How many trie problems should I solve?

Enough to stop needing the hint, which is usually ten to fifteen across the levels, not the whole list. The catalogue tags 41, split roughly 3 easy, 19 medium and 19 hard in the sample we show, so work up rather than across.

What goes wrong most often in trie problems?

Memory. A node per character per branch adds up fast, and a map per node is far heavier than a fixed array when the alphabet is small.

Is practising by pattern better than a problem sheet?

A sheet tells you what to solve. A pattern tells you why those problems sit together, which is the part that carries over to the problem you have not seen. That is why the app files every problem under its pattern.