Available question text
Design a data structure that, given a list of words, returns the index of a word with a given prefix and suffix (return the largest index if multiple, or -1 if none). Because words are short (≤7) and there can be up to 10^4 words/queries, you must preprocess the dictionary to support fast prefix+suffix lookup (e.g., by indexing all prefix–suffix pairs or using a combined trie).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 745. Prefix and Suffix Search
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source