in this question where we need to calculate the total no. of binary strings of given length n not containing any consecutive ones
i have applied the fibonaaci no. concept
my code is as follows:
#include
using namespace std;
int main() {
int f[90+1];
f[0]=1;
f[1]=2;
for(int i=2;i<91;i++){
f[i]=f[i-1]+f[i-2];
}int t;cin>>t;
while(t--){
int k;cin>>k;if(k==0){cout<<0;return 0;}
else
cout<<f[k]<<endl;
}
return 0;
}
can anybody help???