Back to course home
0% completed
Solution: Search Suggestions System
Problem Statement
Given a list of distinct strings products
and a string searchWord
.
Determine a set of product suggestions
after each character of the search word is typed. Every time a character is typed, return a list
containing up to three product names from the products
list that have the same prefix as the typed string.
If there are more than 3 matching products, return 3 lexicographically smallest products. These product names should be returned in lexicographical (alphabetical) order.
Examples
- Example 1:
.....
.....
.....
Like the course? Get enrolled and start learning!