Here i got an error in my code ,in eclipse my output is repeat itself two times
@lukharshiv when u sort ur sample input to {1,1,2,5,6,7,10} first u choose 1 and find the pairs which give 1,1,6, and 1,2,5 and 1,7 now u move to the 2nd number i.e. one again and for this one too u get the combinations 1,2,5 and 1,7 so that is why you are getting these twice …correct that
what should I do to donot repeating this
@lukharshiv
This is a simple question of recursion and backtracking
just insert the present element into temporary vector .incremenet the pointer to next position & add the present array value to sum
also since duplicate values are present we check for the condition
if( j > i and arr[j] == arr[j-1] ) we do no include that combination again
this removes duplicay of combination maaking a target sum