Find Nth Fibonacci Number Using Python in O(log n) Time??

preview_player
Показать описание
Do you know how to find the Nth Fibonacci number in O(log n) time? In this video, I'll show you a quick and easy way to find the Nth Fibonacci number in O(log n) time.

Playing with Fibonacci numbers can be fun and informative! In this video, we'll show you how to use Fibonacci numbers to solve complex problems in a fraction of the time. Whether you're a student trying to solve a math problem or an Engineer trying to solve a engineering problem, playing with Fibonacci numbers can be useful!

Music Credits:

Licensed under Creative Commons Attribution 4.0 International License

Creative Commons Attribution-ShareAlike 3.0 Unported

Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

Рекомендации по теме
Комментарии
Автор

Correction at 2:38, I meant to say "unless n is a power of 2".

kriskotor
Автор

Is there also a a way to do it in O(1) space? Current way uses O(log n) space due to recursion stack.

vokuheila
Автор

Why does this not work for negative numbers? Thanks for the vid!

dnt