Do anyone know the O(logn) approach mentioned in solution


#1

Do anyone know the O(logn) approach mentioned in solution


#2

Using matrix exponentiation


#3

If you notice, the answer pattern is similar to the fibonacci sequence.
To find the answer in O(logn) time, use the program for nth fibonacci number in logarithmic time (which you can find on Geeksforgeeks)