I was unable to solve this during the contest.
Acc. to me , the recurrence formula should be…
Tn+2 = Tn+1.T1 + 2.Tn
and T1 = 2
and T2 = 6
I checked some solutions they use something like Fibonacci Logn method to generate the answer but I don’t get it . Please help and how can I solve these type of questions in Logn when I have recurrence formula.
The Linear recurrence relation formed is a(n) = 2a(n-1)+2a(n-2) which is as good as -
The above equation is for 2*(Fibonacci sequence).
And for calculating nth fibonacci number efficiently -
For proof of nth fibonacci number using matrix exponentiation -
And finally here you go by just replacing 2 (where to replace is left for readers ) in the matrix for getting your nth modified fibonacci sequence.
You have tiles of length 1 and 2 only of colours Blue AND RED
To fill length n from (n-1) length there are two ways Blue and Red tiles of length 1
To fill length n from (n-2) length there are two ways Blue and Red tiles of length 2