Last active
December 15, 2015 01:38
-
-
Save oehme/5180879 to your computer and use it in GitHub Desktop.
Memoized fibonacci method - Xtend source
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
@Memoize def BigInteger fibonacci(int n) { | |
switch n { | |
case 0: 0bi | |
case 1: 1bi | |
default: fibonacci(n - 1) + fibonacci(n - 2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment