Skip to content

Instantly share code, notes, and snippets.

@tjr05d
Last active April 7, 2016 14:26
Show Gist options
  • Save tjr05d/9720905e5be1818628bb71055ebc8441 to your computer and use it in GitHub Desktop.
Save tjr05d/9720905e5be1818628bb71055ebc8441 to your computer and use it in GitHub Desktop.
Ancient City Ruby Challenge
blocks = 10
paths = 0
blocks.times do | n |
paths += 2**(blocks - n)
end
puts "There are #{paths} distinct paths"
#There are 2046 distinct paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment