Leetcode 642. Design Search Autocomplete System
Design an online autocomplete system that processes characters one-by-one, returning the top 3 historically most frequent sentences that match the current prefix (ranked by frequency, then lexicographically), and inserts new sentences when the special character '#' is entered. The core challenge is supporting fast prefix queries and incremental updates over sentence frequencies, typically requiring a prefix-indexed structure (e.g., trie) or efficient top-k maintenance per prefix.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.