You are given an array of strings products and a string searchWord.
Design a system that suggests at most three product names from products after each character of searchWord is typed. Suggested products should have a common prefix with searchWord. If there are more than three products with a common prefix, return the three lexicographically smallest products.
Return a list of lists of the suggested products after each character of searchWord is typed.
Example 1:
Input: products = ["mobile","mouse","moneypot","monitor","mousepad"], searchWord = "mouse"
Output: [["mobile","moneypot","monitor"],["mobile","moneypot","monitor"],["mouse","mousepad"],["mouse","mousepad"],["mouse","mousepad"]]
Explanation:
"m", products with prefix "m" are ["mobile","moneypot","monitor","mouse","mousepad"]. The 3 lexicographically smallest are ["mobile","moneypot","monitor"]."mo", products with prefix "mo" are ["mobile","moneypot","monitor","mouse","mousepad"]. The 3 smallest are ["mobile","moneypot","monitor"]."mou", products with prefix "mou" are ["mouse","mousepad"]."mous", products with prefix "mous" are ["mouse","mousepad"]."mouse", products with prefix "mouse" are ["mouse","mousepad"].Example 2:
Input: products = ["havana"], searchWord = "havana"
Output: [["havana"],["havana"],["havana"],["havana"],["havana"],["havana"]]
Explanation: Only one product matches at every prefix.
Example 3:
Input: products = ["bags","baggage","banner","box","cloths"], searchWord = "bags"
Output: [["baggage","bags","banner"],["baggage","bags","banner"],["baggage","bags"],["bags"]]
1 <= products.length <= 10001 <= products[i].length <= 30001 <= searchWord.length <= 1000