HLD Interview Question- Google

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-09-23Added By Anonymous
Source: Link

Company: Google
Role: l4, l5
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

You are designing a cache system for query–catalog candidate scores.

Each query can have up to 5000 candidate IDs (CIDs).

Each candidate has a score and a frequency counter (how many times it has been accessed).

A key is defined as:

Query:version

A value is a set of (CID, score, frequency) pairs.

Requirements

1.Insert / Update
2.Lookup
3.Eviction

Performance constraint

1.Reads must always be 1 operation.
2.Other operations (insert, eviction, update frequency) must be O(log N) or better.
3.No operation should ever degrade to O(N).

Task

Design the high-level architecture and data structures for this system.

How would you store the data?

How would you efficiently support inserts, lookups, and evictions?

How would you enforce the per-query and global constraints?

Problem statement was to create a Data structure which will give us a high cache hit and with minimum iops.

Comments