Last active
January 22, 2016 22:11
-
-
Save jbranchaud/96f3e57895b65e011947 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NUMBER_OF_BLOCKS = 20 | |
GRID_SIZE = NUMBER_OF_BLOCKS + 1 | |
previous_row = Array.new(GRID_SIZE, 1) | |
(GRID_SIZE-1).times do |_| | |
previous_row = | |
previous_row.each_with_object([]) do |item,current_row| | |
current_row << item + (current_row.last || 0) | |
end | |
end | |
puts "# of unqiue paths: #{previous_row.last}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment