Optimal Algorithmic Approach
HashMap of key → DLL node + sentinel head/tail nodes.
Core Invariants & Edge Cases
- HashMap for O(1) key lookup, doubly linked list for O(1) eviction order
- On get: move node to head (most recent)
- On put: add to head; if over capacity, remove tail (least recent)