Skip to content

Instantly share code, notes, and snippets.

@redsquirrel
Created October 15, 2012 12:03
Show Gist options
  • Select an option

  • Save redsquirrel/3892119 to your computer and use it in GitHub Desktop.

Select an option

Save redsquirrel/3892119 to your computer and use it in GitHub Desktop.
def fib_recursive(i, m = 0, n = 1, count = 0)
return m if count == i
fib_recursive(i, n, m+n, count+1)
end
def fib_iterative(i)
m, n = 0, 1
i.times do
m, n = n, m+n
end
m
end
@redsquirrel
Copy link
Author

You win the fight of most efficient/obfuscated code!

fib_ewd heel-kicks fib_recursive

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