DDSA Solutions

Trie

11 problems · 9 with full explanations

2 Easy4 Medium3 Hard
A trie (prefix tree) stores strings character by character, enabling O(L) insert, search, and prefix queries where L is string length. Use it for autocomplete, word search in a grid, longest common prefix, and IP routing. Each node has up to 26 children (for lowercase letters).

How to practice

To practice Trie problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the trie pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

Start here (Easy + explained)

All Trie problems