Every way to pick candidates from {2, 3, 6, 7} that add up to 7, each candidate usable any number of times. Pick in non-decreasing order so each multiset appears once, and prune the moment a pick would overshoot: nothing below it can recover.
Combination sum to 7 over 4 candidates.
7 still needed, a[0] = 2 fits: pick it, {2}, 5 to go. Candidates from index 0 onward stay available, so 2 may repeat.
Pick 2, 5 to go.
5 still needed, a[0] = 2 fits: pick it, {2, 2}, 3 to go. Candidates from index 0 onward stay available, so 2 may repeat.
Pick 2, 3 to go.
3 still needed, a[0] = 2 fits: pick it, {2, 2, 2}, 1 to go. Candidates from index 0 onward stay available, so 2 may repeat.
Pick 2, 1 to go.
1 is still needed and a[0] = 2 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 2.
Back at index 0. Undo: drop 2, chosen is {2, 2}. Try the next candidate.
Drop 2.
3 still needed, a[1] = 3 fits: pick it, {2, 2, 3}, 0 to go. Candidates from index 1 onward stay available, so 3 may repeat.
Pick 3, 0 to go.
The picks add up to 7 exactly: solution 1, {2, 2, 3}.
Solution 1 is {2, 2, 3}.
Back at index 1. Undo: drop 3, chosen is {2, 2}. Try the next candidate.
Drop 3.
3 is still needed and a[2] = 6 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 6.
Back at index 0. Undo: drop 2, chosen is {2}. Try the next candidate.
Drop 2.
5 still needed, a[1] = 3 fits: pick it, {2, 3}, 2 to go. Candidates from index 1 onward stay available, so 3 may repeat.
Pick 3, 2 to go.
2 is still needed and a[1] = 3 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 3.
Back at index 1. Undo: drop 3, chosen is {2}. Try the next candidate.
Drop 3.
5 is still needed and a[2] = 6 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 6.
Back at index 0. Undo: drop 2, chosen is { }. Try the next candidate.
Drop 2.
7 still needed, a[1] = 3 fits: pick it, {3}, 4 to go. Candidates from index 1 onward stay available, so 3 may repeat.
Pick 3, 4 to go.
4 still needed, a[1] = 3 fits: pick it, {3, 3}, 1 to go. Candidates from index 1 onward stay available, so 3 may repeat.
Pick 3, 1 to go.
1 is still needed and a[1] = 3 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 3.
Back at index 1. Undo: drop 3, chosen is {3}. Try the next candidate.
Drop 3.
4 is still needed and a[2] = 6 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 6.
Back at index 1. Undo: drop 3, chosen is { }. Try the next candidate.
Drop 3.
7 still needed, a[2] = 6 fits: pick it, {6}, 1 to go. Candidates from index 2 onward stay available, so 6 may repeat.
Pick 6, 1 to go.
1 is still needed and a[2] = 6 is more than that. Candidates are sorted, so every later one overshoots too: prune the whole rest of this level.
Prune at 6.
Back at index 2. Undo: drop 6, chosen is { }. Try the next candidate.
Drop 6.
7 still needed, a[3] = 7 fits: pick it, {7}, 0 to go. Candidates from index 3 onward stay available, so 7 may repeat.
Pick 7, 0 to go.
The picks add up to 7 exactly: solution 2, {7}.
Solution 2 is {7}.
Back at index 3. Undo: drop 7, chosen is { }. Try the next candidate.
Drop 7.
2 combinations sum to 7: {2, 2, 3} {7}. Sorting the candidates made 7 prunes possible, each cutting off every larger candidate at once.
2 combinations found.