Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
cpdef int fib(int n):
if n == 2:
return 2
elif n < 0:
raise NotImplementedError
elif n <= 1:
return 1
return fib(n-1) + fib(n-2)
if __name__ == '__main__':
Copy link

JoaoGFarias commented Feb 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment