Last active
August 16, 2019 06:12
-
-
Save caesaneer/5508dfb3323ddbe5060e3867216a548d 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
// Handler that calls generate | |
func ok(w http.ResponseWriter, r *http.Request) { | |
// res := make([]int64, 0, 100000) | |
var res [100000]int64 | |
fibonacci.Generate(&res) | |
// fmt.Println(suc) | |
// fmt.Printf("%T", res) | |
// fmt.Println(res[50]) | |
fmt.Fprintf(w, "OK") | |
} | |
// Generate | |
func Generate(data *[100000]int64) bool { | |
// var result [100000]int64 | |
start := 1000 | |
counter := 0 | |
for start >= 1 { | |
var num = 90 | |
var n1, n2, temp int64 = 0, 1, 0 | |
for num >= 1 { | |
temp = n2 | |
n1, n2 = temp, n1+n2 | |
data[counter] = n2 | |
counter++ | |
num-- | |
} | |
start-- | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment