0 day streak
Anonymous · shared experience20 Apr 2025 · 10 views

Groww: In-memory cache with pluggable eviction policies

Interview question #Groww SDE 2 Machine coding

Problem. In two hours, build a working cache end to end. The spec was deliberately thin, so the candidate had to state their own assumptions. Required operations: add, contains, invalidate, validate, setMaxSize, fetchSize and printMap (dump the current contents).

What the candidate built. FIFO eviction backed by a queue, exercised with hardcoded test data in a driver.

Follow-up. How would the cache support different eviction strategies? The candidate suggested hiding eviction behind an interface.

What mattered. Extensibility above all. The interviewer's main criticism was that hardwiring FIFO doesn't scale as a design, because the eviction rule has to be swappable. Earlier rounds in the same loop were a topological-sort variant (list every job that must finish before a given job, with string job names and a disconnected graph that has cycles) and a stock-order system design with a 10 ms placement SLA.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.