Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created December 25, 2015 18:37
Show Gist options
  • Save hackintoshrao/a75ed81e74a58cd346b4 to your computer and use it in GitHub Desktop.
Save hackintoshrao/a75ed81e74a58cd346b4 to your computer and use it in GitHub Desktop.
First version conatins inefficient code for finding fibonacci numbers
package main
import "fmt"
func main() {
fmt.Println(Fib(3))
}
//Fib inefficent version
func Fib(n int) int {
if n < 2 {
return n
}
return Fib(n-1) + Fib(n-2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment