Math Fundamentals18 sections · 814 units
Open in Course

Lessons from Combination Sum

summary

Three key points:

1.1. Allowing reuse means passing the same index (not i+1i + 1) to the recursive call.

2.2. Pruning (checking if sum exceeds target) avoids wasteful exploration.

3.3. Backtracking works for sum-based constraints just as well as size-based constraints.