The lululemon app needs autocomplete suggestions while a member searches for products. Given a list of unique lowercase product-search words and a lowercase query, return every word that starts with the query, ordered lexicographically.
Implement autocomplete(words, query) using a trie. Each trie node should represent one character. After locating the node for the query, traverse its descendants to collect all matching words.
words, a list of unique lowercase strings, and query, a lowercase string.def autocomplete(words, query):