Fast fibonaci by matrix exponentiation

i’m unable to fix.
my ans is only 2.
help me !

what’s wrong going on ?

only one test cases pass
other failed ?
help me !

i have a better and easy and simple way to multiply matrices usin goperator overloading , look at it

are you saying that
it happen only because of matrix multiplication ?

yes i think so , use this multiplication trick using oops, then calculate answer

take a matrix
0 1
1 1
for ultiplication instead of
1 1
0 1

i has already taken
matrix

0 1
1 1

in case of oops

i am not getting when n = 2 and
n-1

if(n&1)
r = r * a;

how it working?

sorry for n = 1 how it working

it is working because of operator overloading in oops , we have defined the memaning of * for matrices in the class , there for multiplication it will use it