Sir, i need some approach to store the numbers

i have solve it’s previous question. in which we had to find that any subset is present or not whose sum is equal to given key.

hello @chandreshmaurya

yeah the approach is something similar , try to think a bit more in same direction

why will we check for the sum == 0; here is given that sum should be equal to key. and why will be remve the duplicates ?

…

yeah , that is why this problem is similar but not the same.

here need to check sum==key.

its demand of the question, they are asking to print unique subset , so we need to do it

Sir, please the code of this question. i tried but, unable to find the element and store the array.

or, modified in this my code, if possible. code -> https://ide.codingblocks.com/s/460316

…

here u need to store the subset as well so pass a vector in ur function and whenever u add some element in sum then at it to ue vector as well.
also there no point of using count variable for this problem, neither there is any need of bool return type.
see dont try to use code of another question in some other question.
always try to think from scratch , what u have , what are requirements , how u will approach , what return type should be
think all these thing for every problem and write evry single line of the code on ur own, this will improve ur understanding of algorithms , implementation skill.

as of now i will suggest u to rewatch the recursion(subset related) playlist becuase u are commiting too many mistakes .
try to understand each word of the video and then code on ur own without watching the mentor video/implementation.

ohkay sir, i will do definitly whatever u said.

Sir, i tried it one more time. please help to find my error. https://ide.codingblocks.com/s/460741

check this->

no need to bool return type.

sir, in line number 17 and 20, what will be ‘return’ ?

…

only control will return back to calling function, without any value

okay sir, now it’s clear. thank you.

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.