🧠 Before you code — what pattern fits?
Given an array of product names and a searchWord, after each character of searchWord is typed, suggest at most three lexicographically smallest products with the current prefix. Return the list of suggestion lists.
(["mobile","mouse","moneypot","monitor","mousepad"], "mouse") → [["mobile","moneypot","monitor"],…]
🎬 Video explanation · NeetCode
Your solution runs against 2 unit tests, including edge and large-value cases.
Loading...
Test console · 2 unit tests
Submit your code to run it against all 2 unit tests. Results appear here.
JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.