intermediateData Structures & Algorithms~50 minFree
LRU Cache
Build a least-recently-used cache with O(1) get and put, backed by a hash map and a doubly linked list. Add eviction at capacity, non-mutating peeks, and hit/miss statistics.
Build a least-recently-used cache with O(1) get and put, backed by a hash map and a doubly linked list. Add eviction at capacity, non-mutating peeks, and hit/miss statistics.