Your question is Prefix Matching With Strings. 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.
Credit Karma may need to filter search suggestions as a member types into the app. Given a search prefix and an array of suggestion strings, return every suggestion that starts with that prefix.
The comparison is case-sensitive. Preserve the original order and duplicate occurrences from suggestions. If prefix is empty, every suggestion matches. Do not modify the input array.
Implement find_matching_suggestions(prefix, suggestions).
prefix, a string, and suggestions, an array of strings.suggestion.startswith(prefix) is True.def find_matching_suggestions(prefix, suggestions):