3 ms·
Yeah that’s a great example of memoization. Also, the surprising: phi = (1 + sqrt(5))/2.0 def fib(n): return round(phi**n / sqrt(5))
by todd8 8y ago
Yeah that’s a great example of memoization. Also, the surprising:
phi = (1 + sqrt(5))/2.0
def fib(n):
return round(phi**n / sqrt(5))