Fibonacci Numbers

Given an integer N, print the N-th Fibonacci number. A Fibonacci series is a series of numbers in wh…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

What is wrong with this? It says, ‘CPU time exceed’.

n = int(input())
def Fibonacci(n):
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return Fibonacci(n-1)+ Fibonacci(n-2)
print(Fibonacci(n))

Recursion performs slower.
Use for loop.