You are viewing a single comment's thread. Return to all comments →
ans = {0,1} def fibonacci(n): if n <= 1: return 1 c =fibonacci(n-1) + fibonacci(n-2) ans.add(c) return c n = int(input()) fibonacci(n) ans = sorted([i for i in ans]) print(ans[n-1])
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 →