No output coming for the code

I’ve coded for the Sum It Up problem but it shows no output. Can you tell me what is wrong with my code?

Hi @mansi_sharma9kF,
I ur code u r not considering the case in which if the sum is < target, u can either take a[i] or not take a[i]. in ur code if sum<target, u were only considering case of taking a[i].
I have updated ur code. U can hv a look at it.


Try using this approach. In this u will see that the order in which the array is getting printed is not correct. This is because of multiple occurrences of some numbers. So, in order to resolve dis, u can use vector to store elements with sum==target and store these vector in sets i.e u can make set<vector> s.
Hope dis resolves ur doubt.
If u still hv any queries regarding dis, feel free to post them here.

https://ide.codingblocks.com/s/192891 can you explain the errors occurring with the set part

Hi @mansi_sharma9kF,
Sorry for late reply. U can refer to the above code in order to resolve the errors.
First, u cant iterate through set using s[i]. U need to use either using iterators or auto i:s.
Second, in order to take input in vector s, first take input in set and then push the set in vector.
hope dis resolves ur doubt.