Displaying wrong answer in testcase

Please tell where my code is wrong
Here is my code-

Hello @pragyachoudhary1111,

You are taking wrong inputs.
t : no. of test cases.
n: no. of elements in the array.
m: What is this?

Please, read the question properly.

Hope, this would help.
Give a like, if you are satisfied.

I corrected my mistake, but still it is displaying wrong answer

Here is my code-https://ide.codingblocks.com/s/139680

Hey @pragyachoudhary1111,

The base case that you are using are contradictory:
if (n == 0)
return true;
if (n == 0 && sum != 0)
return false;

To satisfy second if-condition, n should be 0.
If n is 0 then first if-condition would satisfy and second if-condition would never execute.

You can refer to the following approach also:
bool isSubsetSum(int *arr,int i,int n){
if(i==n)
return false;
int sum=0;
for(int j=i;j<n;j++){
sum+=arr[j];
if(sum==0)
return true;
}
return zero(arr,i+1,n);
}

Let me know if you still have any issue.

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.