why I failed the all test cases when I was going to submit it, it is just a fibonacci series. pls can uh tell me where is the problem that I failed?
Class assignment problem
@adas0442
This problem can be solved in a manner similar to computing Fibonacci sequence.
For n=1 i.e. string of length 1
{a,b}=2
(First base case)
For n=2 i.e. string of length 2
{aa,ab,ba}=3 //b cannot be together
(second base case)
For n=3
{aaa,aba,baa,aab,bab}=5
fib[3]=fib[2]+fib[1]=3+2=5
For n=4
{aaaa,abaa,baaa,aaba,baba,aaab,abab,baab}=8
fib[4]=fib[3]+fiib[2]=5+3=8
so on…
Concluding: fib[n]=fib[n-1]+fib[n-1]
If you are following this approach and still test cases are not being passed…then please save your code on ide.codingblocks.com and share its link.