~/boss / coin-combos

Combination sum (backtracking)

The Exact Change

Coins of 3, 5 and 7. Find every way to pay exactly 15.

Loading the fight…

How to beat it

Add a coin and subtract it from what's left. Exactly 0? Record the pile. Below 0? Dead end: step back. Never add a coin smaller than the last one, so 3+5 and 5+3 can't both show up.

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

More bosses

esc