Search Suggestions System
00:00
Amazon
Given a list of products and a search word, return 3 lexicographically smallest products that start with each prefix of search word.
Examples
Input → products=['mobile','mouse','moneypot','monitor','mousepad'], word='mouse'
Output → [['mobile','moneypot','monitor'],['mobile','moneypot','monitor'],['mouse','mousepad'],['mouse','mousepad'],['mouse','mousepad']]
Input → word='a' with no matching products
Output → [[]]