Skip to content

Instantly share code, notes, and snippets.

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

diegogaulke commented Sep 30, 2018

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