Subset sum easy problem

What will be the approach to this problem? I didn’t get a proper way to find the solution because its given sum is 0

Hello @krishav49 have you covered the recursion in your course?

Yes, I covered the recursion topic.

@krishav49 okay then the it will be easy for you to understand in this we will make two recursion calls in which the first recursionc call we will add elemets to the sum variable and in the second call we will not add elemnts to the sum variable but we will increase the index to in both the recursion calls and in the base case we will say if the index reaches to n then we will return false but if the sum is equal to the target then it will return true.
In this way we can do this question:
Here fir your reference i am attaching the code:


if you have any doubt you can ask here.
Happy Learning!!

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.