Closed trekhleb closed 1 year ago
The LRUCache implementation example. The solution uses a HashMap for fast O(1) cache items access, and a DoublyLinkedList for fast O(1) cache items promotions and eviction (to keep the maximum allowed cache capacity).
LRUCache
HashMap
O(1)
DoublyLinkedList
The
LRUCache
implementation example. The solution uses aHashMap
for fastO(1)
cache items access, and aDoublyLinkedList
for fastO(1)
cache items promotions and eviction (to keep the maximum allowed cache capacity).