Math Fundamentals18 sections · 814 units
Open in Course

Lessons from Combinations

summary

Three key points:

1.1. Backtracking with a start index prevents duplicate combinations.

2.2. Base case triggers when you reach the target size (kk elements).

3.3. You must copy the current combination before adding it to results, otherwise all entries point to the same array.