Ad

4 line solution, cannot handle large test cases due to recursivity constraint.

Code
Diff
  • def fib(x):
        if x >= 2:
            return fib(x-1) + fib(x-2)
        return max(x, 0)
    
    • def fibonacci(x):
    • if x == 0:
    • return 0
    • elif x == 1:
    • return 1
    • else :
    • return fibonacci(x-1) + fibonacci(x-2)
    • def fib(x):
    • if x >= 2:
    • return fib(x-1) + fib(x-2)
    • return max(x, 0)