Back to problems

Design an index to find sentences by word; support deletion and updates

Algorithm · Amazon · Medium

Build a basic sentence lookup service. Every stored sentence is identified by a distinct sentence_id and contains text made up of lowercase letters and spaces, with exactly one space between consecutive tokens. It must handle these operations: ADD id text: insert a sentence that was not stored previously. DEL id: remove a sentence that is currently stored, so later searches can no longer return it. QUERY word: print the ids of every remaining sentence that includes word,…

Checking your access…