CT027

Autocomplete Scroll Search

MediumAcceptance: 0.0%

The Codetikki scribes have a vast dictionary of ancient words. When a scholar types a prefix, the system should return all words in the dictionary that begin with that prefix. Given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix.

Example 1:

Input: de 3 dog deer deal
Output: deer deal

Example 2:

Input: ca 3 cat car cab
Output: cat car cab

Constraints:

1 <= len(s) <= 100 1 <= number of words <= 10^4 1 <= word length <= 100 All words consist of lowercase English letters

Tags:

trie strings design
Loading...
Test Cases:No test cases
No test cases available.