Back to problems

Inverted Index with Phrase Search

Algorithm · Netflix · Medium

Given a collection of documents, create an inverted index that can answer phrase queries. Input documents: List , where each document’s identifier is its zero-based position in the list phrase: String, made up of one or more words separated by spaces Output Return the original document strings that satisfy the query, in any order. Matching rules For a one-word phrase, include every document that contains that word. For a phrase with multiple words, include a document only…

Checking your access…