Search
⌘K

Leetcode 1858. Longest Word With All Prefixes

Given a list of words, find the longest word such that every prefix of that word is also present in the list (break ties by lexicographical order). The core challenge is efficiently verifying all prefixes (using a hash set or trie) and selecting the longest/lexicographically smallest valid word.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.