Skip to content
We areTOP 1%

LFU Cache

HardLeetCodeDesign Data Structures
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Map each frequency to a recency-ordered list of keys and track the minimum frequency. An access moves a key to the next frequency's list; eviction removes the least recent key from the minimum-frequency list.

More in Design Data Structures

Design Data Structures questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Insert Delete GetRandom O(1)LeetCodeMedium Solve Insert Delete GetRandom O(1) on LeetCode (opens in a new tab)
2LRU CacheLeetCodeMedium Solve LRU Cache on LeetCode (opens in a new tab)
3Design TwitterLeetCodeMedium Solve Design Twitter on LeetCode (opens in a new tab)
4Snapshot ArrayLeetCodeMedium Solve Snapshot Array on LeetCode (opens in a new tab)
5Glass CarvingCodeforcesMedium 1500Solve Glass Carving on Codeforces (opens in a new tab)
6Lunar New Year and Food OrderingCodeforcesMedium 1500Solve Lunar New Year and Food Ordering on Codeforces (opens in a new tab)
7Constructing the ArrayCodeforcesMedium 1600Solve Constructing the Array on Codeforces (opens in a new tab)
8Two TeamsCodeforcesHard 1800Solve Two Teams on Codeforces (opens in a new tab)
9Maximum Frequency StackLeetCodeHard Solve Maximum Frequency Stack on LeetCode (opens in a new tab)
10LFU CacheLeetCodeHard Solve LFU Cache on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account