Skip to content

Instantly share code, notes, and snippets.

@kristenmills
Created May 29, 2012 22:37
Show Gist options
  • Save kristenmills/2831209 to your computer and use it in GitHub Desktop.
Save kristenmills/2831209 to your computer and use it in GitHub Desktop.
Project Euler 76
def solve
nums = 1.upto(100).to_a
goal = 100
ways = Array.new
ways << 1
goal.times do
ways << 0
end
nums.each do |num|
num.upto(goal) do |x|
ways[x] += ways[x-num]
end
end
return ways[goal]-1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment