You are viewing a single comment's thread. Return to all comments →
You can use Exception (Try/ Catch) to make it more fast !
mem = {} def fibonacci(n): if n < 2: return n try: return mem[n] except: mem[n] = fibonacci(n - 1) + fibonacci(n - 2) return mem[n]
Seems like cookies are disabled on this browser, please enable them to open this website
Recursion: Fibonacci Numbers
You are viewing a single comment's thread. Return to all comments →
You can use Exception (Try/ Catch) to make it more fast !