Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.