LRU Cache

Try to solve the LRU Cache cache problem.

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 existing key with a new value.
  • Get(key): Returns the value of the key, or
...

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy