LRU Cache
Understand how to implement an LRU cache class with capacity constraints, supporting key-value insertion and retrieval while evicting the least recently used entries when full. This lesson guides you through the logic behind cache eviction policies and challenges you to apply the LRU algorithm in code.
We'll cover the following...
We'll cover the following...
Statement
Implement an LRU cache class with the following functions:
- Init(capacity): Initializes an LRU cache with the capacity size.
- Set(key, value): Adds a new key-value pair or updates