LRU Cache (incl. Weighted Variant)

CodingxAILast reported February 2026Medium Frequency
Reported
4× across candidate reports
First seen
June 2025
Last reported
February 2026
Reported outcome
unknown

Problem Overview

Implement an LRU (Least Recently Used) cache supporting get and put. The standard variant uses a fixed item-count capacity: get(key) returns the value if present and marks it most recently used; put(key, value) inserts or updates, evicting the least recently used entry when capacity is exceeded. A weighted variant…

  • 3 candidate-reported follow-ups — the exact probes interviewers asked, with the trigger for each
  • The rest of the problem statement — full requirements, constraints, and edge cases
  • Approach and trade-offs — what passing candidates did, and the mistakes that sink people
Unlock the full xAI catalog
Full problem statements, candidate-reported follow-ups, and walkthroughs — for every xAI question.
Unlock with Pro
Already a member? Sign in
Verified Source
Every question is reconstructed from multiple independent candidate reports. Verbatim follow-ups, not invented ones.
Codex Fact-Checked
Technical claims, formulas, and scale numbers are reviewed against primary sources.
Interviewer Follow-ups
The exact follow-ups reported by candidates, with the trigger that prompts each one — plus the mistakes that sink people.
Is this helpful?