Build a data structure for fast word lookups and autocomplete. A Trie stores words as nested nodes, where each path from root to a node represents a prefix. Implement insert(word), search(word), and startsWith(prefix) in O(m) time, where m is word length.
No results yet
Run your code to check it against the examples, or submit to run every test.