Deviopath › Go

Prefix Trie

Hard · Data Structures

A trie stores words by character. Insert adds a word. StartsWith(prefix) returns every inserted word that starts with prefix, sorted.

Write Insert and StartsWith on Trie. RunTrie(words, prefixes) is already written.

Next: Shortest Path