LRU Cache, three ways

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Cost

Work done so far, and how the three solutions compare

Calls and cache

Least recently used on the left

Keyboard: ← → step, Space play or pause. Type calls like "LRUCache 2, put 1 10, get 1" (capacity 1–5, up to 14 calls, keys 0–99, values 0–999), or paste LeetCode's format. The C++ linked-list version deletes removed nodes; Java and Python leave that to the garbage collector.