LFU Cache in O(1)

hard
Unit 24 · Heaps0/2 to milestone

An LFU (least frequently used) cache evicts the key that has been accessed the fewest times. Ties are broken by evicting the least recently used of those keys.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
LFU Cache in O(1) · TechGradify