my code is here
please find the mistake the given testcase works just fine also this test case
2
4
-3 -4 2 2
9 2 -7 -2
works but idk why all cases in submit dont work
Subset sum problem
the problem in your code is your base case, you are comparing arr[i] with target but we have to check whether the sum is zero or not.
Also you are not considering the case when no element is taken but sum is zero.
Modify you code for the case when no element is taken but target is still zero (as initialized).
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.