Class Assignment Problem

how to solve this 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”