Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Design an LFU Cache

HardSystem Design00:00
Practice interviewer
In session
5 left
00:00

Your question is Design an LFU Cache. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Design a Least Frequently Used Cache, with an optimal cache design solution.

Asked in the Round 2 - face-to-face technical stage. One of three problems to code optimally within one hour.

Explain the data structures and invariants, then implement the cache with constant-time get and put operations. Define how ties between equally frequent entries are resolved, how updates affect frequency, and how zero-capacity caches behave. Discuss time and space complexity and the edge cases you would test.