how to solve this problem
Class Assignment Problem
@vivekpatel
In this question, you have to find total number of n digit integer which can be formed using βaβ and βbβ such that two bβs can never be in adjacent position. So let say 1st digit is βaβ then next digit can be βaβ or βbβ, so total no. of n digit integers formed after fixing first digit as βaβ is total no. of (n-1) digit integer formed using βaβ and βbβ.
Similarly if you fix 1st digit as βbβ then next digit must be βaβ, so total no. of n digit integer formed after fixing first digit as βbβ is total no. of (n-2) digit integer formed using βaβ and βbβ
Thus ans(n) = ans(n-1) + ans(n-2); which seems like fibonacci series with ans(1)=2 and ans(2)=3;
it is not passing the test cases
@vivekpatel
your code is correct but the way you print output is wrong. you donβt have to print β#n : ansβ but you have to print β#testcase_number : ansβ