Sum it up challenge

getting wrong answer in two of the test cases.
please check and guide
here is my code

Hey @aditikandhway
All nos are not single digit so thats why ur logic is not working .

Also there are testcases as well and u are not solving it for test cases(I am referring to this question here: :https://hack.codingblocks.com/app/contests/1873/621/problem)

his is the approach->
first sort ur given input array (because then only we can generate lexicographical order)
then generate all subsets recursively ,
then in base case of ur recursive code check if sum of the generated subset is equal to target or not.
if it is then insert that subset(as a vector) in a set (set because it will remove duplicate subsets and it will keep all of them in sorted order)

at last print ur set

Here refer to this code if req :slight_smile:
https://ide.codingblocks.com/s/356701?_ga=2.236739777.1350203873.1600106484-1795954092.1597348154

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.