Hello.
I'm not fluent in Java so I won't implement it by myself, however there is an O(log n) solution for finding nth Fibonacci number which is based on matrix exponentiation -
[[1 1] [1 0]]^n = [[F_{n+1} F_n] [F_n F_{n-1}]]
This can be done with exponentiation by squaring which is O(log n).
Hello.
I'm not fluent in Java so I won't implement it by myself, however there is an
O(log n)solution for finding nth Fibonacci number which is based on matrix exponentiation -This can be done with exponentiation by squaring which is
O(log n).