Your question is Prefix Search with Autocomplete. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of lowercase strings words and a query string prefix, return all words that start with prefix, in lexicographic order. If no words match, return an empty list. Your solution should support repeated queries efficiently.