Skip to content

Instantly share code, notes, and snippets.

Last active November 17, 2020 12:41
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Fastest, coolest, fibonacci algorithm golang with dynamic programming
package main
import (
func fib(n int) *big.Int {
fn := make([]*big.Int, n+1)
for i := 0; i <= n; i++ {
var f = big.NewInt(0)
if i <= 2 {
} else {
f = f.Add(fn[i-1], fn[i-2])
fn[i] = f
return fn[n]
func main() {
Copy link

Thank you.
I will use it in my project with Gin framework, to show the performance of go with fib and gin framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment