Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

most efficient fibonacci number algorithm

>>> def fib(n, computed = {0: 0, 1: 1}):
...     if n not in computed:
...         computed[n] = fib(n-1, computed) + fib(n-2, computed)
...     return computed[n]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #efficient #fibonacci #number #algorithm
ADD COMMENT
Topic
Name
7+8 =