Can please someone tell me what is wrong with this code.
The test cases are not passing
https://online.codingblocks.com/player/4159/content/851?s=373
Here is my code
#include
using namespace std;
int flag=0;
void allsums(int *a,int n,int pos,int value)
{
for(int i=pos;i<n;i++)
{
int current=value+a[i];
if(current==0)
flag=1;
allsums(a,n,i+1,current);
}
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int *a=new int[n];
for(int i=0;i<n;i++)
cin>>a[i];
allsums(a,n,0,0);
if(flag==1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
flag=0;
return 0;
}