Subset sum easy testcase doubt

1 test case is not passing

see there is a little bit mistake in your logic…you are considering the fact that 0 can be made of only two element but the set which sums to 0 can have more than two elements…
for ex) consider this set-{1,2,3-6} so this set is non empty and sums to 0…moreover when you are iterating over an array in recursion the base case should be

if(lastIndex==arr.length){
}
here is a modified code you can refer to it…i have also kept an string ans…in base case i have commented that line…if you want you can remove the comment and print ans to see the subsets which are getting formed…
just APPROACH this problem as subset sum problem

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.