~/boss / loot-packs

Subsets (backtracking)

The Loot Bag

Every item is a yes or no. Pack every possible bag without missing one.

Loading the fight…

How to beat it

Take the first item and go deeper. At the bottom, record the bag. Then step back: undo the choice, skip the item, and go deeper again. Every path from top to bottom is one bag, so n items make 2^n bags.

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/subsets there. Sign in with your email to keep your progress on every device.

More bosses

esc