NeetCode #486LC-642HardTriesNC Algo100
← Back to All Problems

#486 · #642 · Design Search Autocomplete System(设计搜索自动补全系统)

📌 Problem Statement & Constraints

Design a search autocomplete system. AutocompleteSystem(sentences, times) initialises with historical sentences and their frequencies. input(c) consumes one character and returns the top 3 historical sentences starting with the current prefix, ordered by frequency then ASCII order. '#' ends the sentence. Constraints: at most 100 sentences, 10 characters each; at most 5000 calls.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!