Created
June 25, 2014 21:37
-
-
Save MarkRoddy/b5a523b07b5d866b1933 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
var inner func(n 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