Prompt
Implement class LRUCache(capacity):
get(key)→ value, or-1if missing; a hit makes the key most-recently-usedput(key, value)→ inserts/updates; over capacity evicts the least-recently-used entry- Both operations O(1)
Hint: a JS Map remembers insertion order — that's the whole trick.
Hints
Solution
Your Code
20 min