Design an `LRUCache` class with a fixed `capacity`. `get(key)` returns the value or `-1` if absent; `put(key, value)` inserts or updates. Both count as a use, marking the key most-recently-used. When `put` would exceed capacity, evict the least-recently-used key first. Aim for O(1) per operation. (Asked at Amazon, Microsoft, and Google.)
+ 2 hidden tests run on Submit.
Backing the cache with a Map gives O(1) lookup plus insertion-order iteration. Re-inserting a touched key moves it to the most-recent position; when size exceeds capacity, the first key from `map.keys()` is the least-recently-used and gets evicted. Production implementations use a hash map plus a doubly linked list for the same O(1) guarantees.
Run your code to see results.