My code is working perfectly fine on giving custom input but only one test case gets passed
What is wrong with my code?
Your code is failing for inputs like : 0 0 0 0
You can easily think of this question as calling recursively the function, once when it does not take the current element into subset and other in which it takes the element into the subset. When we encounter sum = 0 we return true.
Hope it Helps.
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.