Skip to content

Instantly share code, notes, and snippets.

View scottmascio2115's full-sized avatar

Scott Mascio scottmascio2115

View GitHub Profile
# 1. Describe
# Contianer- A container is is simply a place to contain a collection of other objects
# They are used for storing objects in a specific way under set rules.
# ------------
# 2. Implement a container with all even numbers from 1..100
def container(array)
ray = Array.new
array.each do |x|
if x % 2 == 0
@scottmascio2115
scottmascio2115 / recursive_methods.rb
Created August 11, 2013 21:29
recursive_methods.rb
def choose_team(n, k)
return n if k == 1
return 0 if n == 0
choose_team(n-1, k-1) + choose_team(n-1,k)
end
puts choose_team(6,3) == 20
puts choose_team(6,2) == 15
puts choose_team(24,4) == 10626