Search⌘ K
AI Features

LRU Cache

Understand and implement an LRU cache class in C# that supports initialization with capacity, setting key-value pairs, and retrieving values with eviction of the least recently used items when full. This lesson deepens your skills in custom data structures for efficient caching solutions.

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
...