Created
December 25, 2015 18:37
-
-
Save hackintoshrao/a75ed81e74a58cd346b4 to your computer and use it in GitHub Desktop.
First version conatins inefficient code for finding fibonacci numbers
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
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