Created
May 8, 2020 03:16
-
-
Save keichi/4cb14484ab68c685ec729a6cf8232530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpdef fibonacci(int n): | |
if n < 2: | |
return n | |
cdef int a = 0 | |
cdef int b = 1 | |
for i in range(2, n + 1): | |
a, b = b, a + b | |
return b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment