Let's take another example. If the input was [3, 2, 5, 1] and our target number was 6, we'd witness the following if we did tried the brute force solution by hand:
xxxxxxxxxx// the left side are the subsets we're trying3 & 2 // curr_sum is 5, < 6, continue3 & 2 & 5 // too big, skip2 & 5 // curr_sum is 7, skip5 & 1 // match!OUTPUT
Results will appear here.