Subset sum easy problem through recursion

it is always printing yes
kindly rectify the code plz

hi @shabadsingh please share your code using CB IDE

@Ishitagambhir
sorry i forgot to add the code


this is the ide link kindly rectify the code

hi @shabadsingh the problem is that, for an empty subset also the sum will be 0. and empty subset will always be there, you have to consider non-empty subsets only.
One thing you can do is maintain a count variable which is initally set to 0, if you are choosing an element, you can increment count by 1 in the recursive call.
In the base case, print yes only if sum is 0 and count > 0

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.