Skip to content

Instantly share code, notes, and snippets.

@bibikovilya
Last active September 8, 2016 10:15
Show Gist options
  • Save bibikovilya/4f7d8deaa7d2a8f3efff to your computer and use it in GitHub Desktop.
Save bibikovilya/4f7d8deaa7d2a8f3efff to your computer and use it in GitHub Desktop.
def fib(n)
return 1 if n == 1 || n == 2
return fib(n-1) + fib(n-2)
end
def fakt(n)
return 1 if n == 1
return fakt(n-1)*n
end
def sum(arr, i)
return (i == 0) ? arr[0] : sum(arr, i--) + arr[i]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment