LRU Cache

Design an LRU cache:

  • LRUCache(capacity) initializes the cache.
  • get(key) returns the value if present, otherwise -1, and marks the key as most recently used.
  • put(key, value) inserts or u...

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: