Getting wa in 2 test cases

#include

using namespace std;

int solver(int n)
{
int i=1,count0=1,count1=1;
while(i<n)
{
int temp=count1;
count1=count0+count1;
count0=temp;
i++;
}
return count0+count1;
}
int main(int argc, char const *argv[])
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
cout<<solver(n)<<endl;
}
return 0;
}

We will use bottom up DP and get this things done in linear time!
Just think from length 1…2…3… Memoize it!
You’ll find a pattern. It’s easy.
Think for it!!

Please have a look at this very short code snippet here