Why it isb not passing any test case

#include
using namespace std;
int subsetSum(int arr[], int n, int i, int sum, int count)
{
if (i == n) {

    if (sum == 0) {
        count++;
    }
    return count;
}
count = subsetSum(arr, n, i + 1, sum - arr[i], count);
count = subsetSum(arr, n, i + 1, sum, count);
return count;

}
int main()
{
int t;cin>>t;
while(t–){
int n;cin>>n;int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
int sum=0;
if(subsetSum(arr, n, 0, sum, 0)){cout<<“Yes”<<endl;}
else cout<<“No”<<endl;
}
}

Hello @argus please wait i am checking your code :

@argus i have corrected your code:


you have initialised as your sum 0 then there is possibility that it reaches to the end and as your sum is zero then it must be givin the answer true for that as well.

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.