Implement Trie — interactive algorithm visualization

Medium · Trie · time O(L) · space O(N·L)

Insert words into a prefix tree, then test a prefix by walking character edges. Shared prefixes share nodes.

Example input: words = ["cat","car","dog"], prefix = "ca"

Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.

Solve Implement Trie in the editor · All 16 visualizations

Previous: Connected Components ·