Question: 9 Search Suggestion System For an array of n strings products and a word to search search design a system that when each character of
9 Search Suggestion System For an array of n strings products and a word to search search design a system that when each character of the searched word is typed suggests at most three product names from the products array The suggested products should share a common prefix with the searched word If more than three products exist with a common prefix report the three product names that appear first in lexicographical order Return the suggested products which will be a list of lists after each character of the searched word is typed Note A string x is considered lexicographically smaller than another string y if x will occur before y in the English dictionary Example Suppose n 5 products carpet cart car camera crate and search camera
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
