Approach hintTry it first, then revealHide
Insert every word into a trie, then explore only through nodes that end a word, since each prefix must itself be in the list. Visiting children in alphabetical order makes ties resolve to the smallest word.
Insert every word into a trie, then explore only through nodes that end a word, since each prefix must itself be in the list. Visiting children in alphabetical order makes ties resolve to the smallest word.