4 ms·
Technically, you can calculate the nth Fibonacci number in O(1) with the golden number.
by AlexanderTheGr8 5y ago
Technically, you can calculate the nth Fibonacci number in O(1) with the golden number.
- Jtsummers 5y agoIt's still O(n) or O(log(n)) as you have to compute the value using exponentiation to the nth power. Which offers either a linear algorithm or a faster logarithmic algorithm if you use fast exponentiation. It isn't actually O(1).