Skip to content

Instantly share code, notes, and snippets.

@epequeno
Created August 12, 2011 20:03
Show Gist options
  • Save epequeno/1142873 to your computer and use it in GitHub Desktop.
Save epequeno/1142873 to your computer and use it in GitHub Desktop.
fibonacci practice
package main
import "fmt"
//import "strconv"
var known = map[int] int{0:0, 1:1}
func fibo(n int) (result int) {
if value, ok := known[n]; ok {
result := value
return result
}
result = fibo(n - 1) + fibo(n - 2)
known[n] = result
return result
}
func main() {
fmt.Println(fibo(300))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment