Sum it Up problem in recursion

I have been trying this problem for hours now. I am generating all the subsets of the given array and storing those array in a set of strings by converting the integer array into string (in order to get unique permutations) whose sum is equal to the target sum and later copying them in vector in order to sort them lexicographically. I think the logic is correct but still, I’m not getting the desired output.


Please, look into my code.

@div_yanshu07
Will get back to you asap.

@div_yanshu07
This is the updated code.
https://ide.codingblocks.com/s/337186

There were some changes which had to be made. In the base case, use j in place of len because there are elements till (j - 1) in the out array. Also replace i with k in the loops in the base case because i is one of your arguments.

Sort the initial array because then the string will be sorted within itself. Also, use a custom comparator to sort the strings instead of simple sorting. If you face any difficulty in understanding the logic of the custom comparator, revert back.

If my answer is able to answer your doubt, please mark the doubt as resolved.