BLOG | Find the rightmost & leftmost set bit of an integer

This is a classical interview question in which you are asked to find the location of the rightmost and the leftmost 1's in the binary representation of a number. I. Rightmost Set Bit & Rightmost Bit Here we compute the AND between the original number (say N) with its two's complement (its negative form). Thus,… Continue reading BLOG | Find the rightmost & leftmost set bit of an integer

BLOG | Inverted index: search keywords in a list of documents

Given a list of documents and a list of keywords, how do we find all documents containing one or multiple keywords? For this question, we tokenize all documents into terms, and create a inverted index where each term is associated with a list of documents that contains that term. We use this information to rank… Continue reading BLOG | Inverted index: search keywords in a list of documents