Employeur impliqué
Implement the Fibonacci sequence with O(n)
Utilisateur anonyme
Python: def iterative_fib(n): last_1 = 0; last_2 = 1; for i in range(1, n): fib = last_1 + last_2 last_1 = last_2 last_2 = fib return fib The recursive solution IS NOT O(n)!