Failed testcase

#include<bits/stdc++.h>
using namespace std;

int ansdp(int n){
if(n==0){
return 0;
}

int a[n];
int b[n];
a[0] = b[0] = 1;

for(int i=1;i<n;i++){

  a[i] = b[i-1];
  b[i] = b[i-1] +a[i-1];

}

return a[n-1] + b[n-1];

}

int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
int n;
cin>>n;
cout << ansdp(n) << endl;
}
}

answer is wrong in some testcase

Hi @Mohitpandey29

Your code is perfectly alright. I think there is some problem with the checker system of this problem.
Rest assured.

Hope it Helps.

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.