Last active
August 29, 2015 14:03
-
-
Save MarkRoddy/6b8b3615d292f5eb4bfa 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
func dynFib(m int) int { | |
inner := func(n int) int { | |
switch { | |
case n == 0: | |
return 0; | |
case n == 1: | |
return 1; | |
default: | |
return inner(n-1) + inner(n-2) | |
} | |
return 0 | |
} | |
return inner(m) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment