febonacci relation is not working and also the count function as explained in the video
#include <bits/stdc++.h>
using namespace std;
int count(int n,int lastd){
if(n==1){
return 2;
}
if(lastd==0){
return count(n-1,0)+count(n-1,1);
}
if(lastd==1){
return count(n-1,0);
}
}
int dp1[1005];
int febo(int n){
if(n==1){
return 2;
}
if(n==2){
return 3;
}
if(dp1[n]!=0){
return dp1[n];
}
return dp1[n]=febo(n-1)+febo(n-2);
}
int main() {
int t,n;
int dp[105];
dp[0]=1;dp[1]=2;
for(int i=2;i<=105;i++){
dp[i]=dp[i-1]+dp[i-2];
}
cin>>t;
while(t–){
cin>>n;
memset(dp1,-1,sizeof(dp1));
//cout<<dp[n]<<endl;
cout<<febo(n)<<endl;
}
return 0;
}