~/boss / inventory
LRU cache (least recently used)
The Full Inventory
Your bag is full and you just found a sword. Who gets thrown out?
Loading the fight…
How to beat it
Keep the items in a line by last use. Use one and it jumps to the front, so the back is always the item you haven't touched the longest. Bag full? The one at the back goes.
Now the real boss
Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.
On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/lru-cache there. Sign in with your email to keep your progress on every device.