Search⌘ K
AI Features

LRU Cache

Explore how to implement an LRU cache class that supports initialization, setting, and getting key-value pairs with efficient eviction of the least recently used items. Understand the caching principles and constraints to solve related coding interview problems effectively.

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