Design a data structure that implements a Least Recently Used (LRU) cache. Implement: - get(key): Return the value if key exists, else .
Mark as recently used. - put(key, value): Insert or update. If at capacity, evict the least recently used item first. Both operations must be .
You're solving a classic system design question that combines two data structures. The hash map provides lookup.
The doubly linked list maintains usage order with move-to-front and remove-from-back operations. Constraints: capacity from to , up to operations.