NeetCode #340LC-460HardLinked ListNC 250
← Back to All Problems

#340 · #460 · LFU Cache(LFU 缓存)

📌 Problem Statement & Constraints

Design a Least Frequently Used (LFU) cache with a fixed capacity. get(key) and put(key, value) must run in O(1). On eviction, remove the least frequently used key; ties are broken by least recent use. Constraints: 0 <= capacity <= 10^4; at most 2 * 10^5 calls.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!