SUBSET SUM EASY problem

AM GETTING A CONTINUOUS OUTPUT i.e yes’s or no’s

my code
https://ide.codingblocks.com/s/41258

question link;
https://hack.codingblocks.com/contests/c/512/136

Hey Jay, your approach is not correct for this problem, you have to find the subsets of the array in this problem. you can refer this code.

IN CLASS WE WERE TAUGHT HOW TO FIND ALL THE SUBSEQUENCES OF A STRING SO IN A SIMILAR WAY I WAS FINDING ALL THE SUBSETS OF A SET ITS JUST THAT IN SUBSEQNS WE TOOK AND DIDNT TOOK ONE CCGARACTER AND HERE WE DO THE SAME WITH N.O S INSTEAD OF CHARACTER AND THEN SEE IF IN ANY ARE WE GETTING 0 AS ANSWER

Hey Jai, you are supposed to find all the subsets first and then check if any subset sum is zero but you are not doing this in your code.

You have to check for two cases:
1: when you have included the number(array element)
2: when you have not
if you get zero sum from any of these calls/cases you should return true
otherwise false.
Hope this helps.

For further clarification you can check this code :https://ide.codingblocks.com/s/42642
This code takes O(2^n) complexity.
Try to think for a otpimised solution also.