~/boss / treasure-bag
0/1 knapsack (dynamic programming)
The Loot Limit
Your bag holds 10 kg. Take or leave each treasure, cell by cell, and max the loot.
Loading the fight…
How to beat it
Rows are treasures, columns are bag sizes. Each cell asks: take this treasure or leave it? Leave it: the value from the cell above. Take it: its value plus the best for the space that's left, one row up. The bottom-right corner is the answer.
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/book-shop there. Sign in with your email to keep your progress on every device.