LRU + LFU + Custom Eviction Function
Asked at Citadel · Coding Questions · Difficulty: Hard · Last asked Jan 25, 2026
Build a fixed-capacity key-value cache in three steps: first with a least-recently-used eviction rule, then with a least-frequently-used rule, and finally as one cache class whose eviction rule is supplied from outside as a policy object. Keys and values are integers; every operation below must run in `O(1)` amortized time.
Loading the problem…
More Citadel interview questions
- LLM Fundamentals: Quantization, FlashAttention, Parallelism
- LLM Questions: Training Systems, Hardware, and Scaling
- OLS Regression Between Independent Gaussian Random Vectors
- EQR Alpha-Factor Research Deep-Dive + LLM Inference Stability
- HFT Onsite Round 3 — Sort Complexity + Linux Fundamentals + tail(n) Design
- Weighted Random Sampling with Insert - Delete