Skip to main content
mediumNeetCode 150

Time Based Key-Value Store

Part 1: Simple Cache - set(key, value): store a value - get(key): return value for key, or "" if missing

Each key holds multiple values at different timestamps, and you need the most recent value at or before a given time. Interviewers love it because it reveals your binary search precision—one wrong boundary update can loop forever. The trap is boundary drift. Nail this and temporal queries become second nature.

Arrays & HashingBinary SearchDesign

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Simple Cacheeasy
2Part 2
3Part 3
4Part 4

Each locked part opens in the editor once the part before it passes.

Based onLeetCode