Code is giving segmentation fault

hello @jha.aparna17
here u need to receive value return by ur function call.
image

and then if any of them is true then return true otherwise return false.

also u need to handle empty subset case (empty subset will also have sum 0 but u need to print true only when there exist non empty subset).

im not able to code the empty subset case. pls help

use one extra variable to count elements in subset .
if ur r includeing current element in ur sum then increment count by one

otherwise pass the same value of count.

in base case check for two conditions
if sum==0 and count > 0 return true
else
return false

code is still not working

check now->

its giving run time error

the code got accepted but why was there a need to use result1 and result2 variables?

see in one case we r exluding current element and in other case we r including current.
so if any of the two case can generate 0 sum subset then we should print true.
thats why i am considering result from both the cases.
ans if any on the results comes true , i m returning true.

alright… thank you very much