As reported: Nutanix MTS-2 (Python), India (2026), round 1: given
entries[]andsearchInput, return the top 3 words matching the input (a Trie / prefix search). The round ran out of time before this one was finished.
This is LeetCode 1268 — Search Suggestions System: given a list of products and a searchWord, after each character of searchWord is typed, suggest at most three products that start with the typed prefix. When more than three match, return the three lexicographically smallest. Return the list of suggestion lists. (The single-input version from the round is the last list.)
Example 1
products = ["mobile","mouse","moneypot","monitor","mousepad"], searchWord = "mouse"
-> [["mobile","moneypot","monitor"],
["mobile","moneypot","monitor"],
["mouse","mousepad"],
["mouse","mousepad"],
["mouse","mousepad"]]
Example 2
products = ["havana"], searchWord = "havana" -> six times ["havana"]
Constraints: 1 ≤ products.length ≤ 1000; 1 ≤ products[i].length ≤ 3000; total characters ≤ 2 · 10^4; 1 ≤ searchWord.length ≤ 1000; lowercase letters; products are unique.
Code runner format: one JSON value per line: products, then searchWord (LeetCode's format). Implement suggestedProducts(products, searchWord); the harness prints the list of lists.