Skip to content

Instantly share code, notes, and snippets.

@mattdvhope
Created August 31, 2013 20:42
Show Gist options
  • Save mattdvhope/6400511 to your computer and use it in GitHub Desktop.
Save mattdvhope/6400511 to your computer and use it in GitHub Desktop.
recursive_methods.rb
def choose_team(n,k)
return 0 if n == 0
return n if k == 1
choose_team(n-1, k-1) + choose_team(n-1, k)
end
p choose_team(24, 4) # pairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment