Microsoft | SSE | LLD

Hi Everyone,

Today i completed my 1rst round of Microsoft Screaning round.

Round 1: LLD

Implement Local Search with Ranking

The interviewer gave a problem where we had a large set of locally stored items (documents/tasks/records), each having an id, type, name, optional content, and last updated time. The goal was to design a fast search experience that feels instant while typing, even when the dataset is very large.

The search had multiple constraints:

Search should work on both name and content

Prefix matches in name should rank highest

Substring matches in name should rank next

Matches only in content should rank lowest

Results could optionally be filtered by type

The system had to support incremental updates (add/update/remove) without rebuilding the entire index

I started by clarifying that a brute-force scan on every keystroke would not scale and explained that we need to pre-index the data in memory to trade memory for latency. I proposed an in-memory indexing approach using:

A prefix index for fast name prefix lookups

A lightweight inverted index for content matching

A scoring mechanism to handle ranking

Comments (1)