How can i remove the repeat cases in this sum it up program

i am getting following output for the given test case

1 1 6
1 2 5
1 7
1 2 5
1 7
2 6

Hi @vinaykumar4530
If you are able to generate the required combinations then removing the repetition part is easy. You can use a set for this. Put each of these combinations in a vector and make a set of vectors in global .
set< vector< int > > s ;
Put these combinations into the set. Make sure to sort each of these combinations before inserting them into the set.
The special thing about a set is that it removes repetition. So same combinations would only occur once in the set. Once you are done with your recursive calls, print the combination vectors in the set one by one.

1 Like

ok thanks for the help