Expand description
§fast-fibonacci
fast-fibonacci
uses linear recurrence to quickly find fib(n, mod) in O(log(n)) time.
Adapted from http://fusharblog.com/solving-linear-recurrence-for-programming-contest/
Functions§
- bigfib_
with_ mod - BigUint version of fib_with_mod. Finds the nth fibonacci number with modulo. Runtime O(log(n))
- fib_
with_ mod - Finds the nth fibonacci number with modulo. Runtime O(log(n))