Design an LRU Cache

Design a fixed-capacity LRU (Least Recently Used) cache supporting:

  • get(key): Return the value for key if present and mark the key as most recently used; otherwise return -1.
  • `put(key, valu...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: