Https://online.codingblocks.com/player/3066/content/773

https://online.codingblocks.com/player/3066/content/773

i am having problem with subset sum
i am able to pass base test case but fail in others

here is my code using bit masking

#include
using namespace std;
#define ll long long
// function calculate sum of subsets
ll count_sum(int temp , int *arr ){

 ll sum =0 ;
 int j =0 ;
// j is pointer to get the index of particular index inarry to add
 while(temp){
    
        if(temp&1){
           sum +=arr[j];
             
        }
           j++;
        ;
    
                     
        temp =temp>>1; 
            
    }
   
return sum ;

}

int gen_subset(int *arr , int n){
for(int i =1 ; i<(1<<n)-1;i++){
int temp =i;
ll sum = count_sum(temp , arr);
// calculating sub set sum and checking if it is 0 if 0 return 1
if(sum==0)
return 1;

}

return 0 ;

}

int main(){
int t , n ;
int arr[100005];

cin>>t;

while(t–){

cin>>n;

for( int i =0 ; i< n ;i++){
cin>>arr[i];
}

if(gen_subset(arr , n)){
cout<<“yes”;
}
else{
cout<<“no”;
}

}
return 0;

}

I think you are getting Time Limit Exceeded in one of these test cases.
This problem can by optimized using Dynamic Programming.

No sir i am able to pass base test case but my code fails rest other test cases (1 4 1 2 3 -3)

I am sharing you my code
https://ide.codingblocks.com/#/s/12966

TESTCASE #1: wrong-answer 0
TESTCASE #2: wrong-answer 0

Sir one more thing it would be better if it was given for what case my code failed not just message saying TESTCASE #1: wrong-answer 0