Skip to content

Instantly share code, notes, and snippets.

Created June 13, 2014 14:49
Show Gist options
  • Save anonymous/121297a654a6b15358f9 to your computer and use it in GitHub Desktop.
Save anonymous/121297a654a6b15358f9 to your computer and use it in GitHub Desktop.
result = [1]
loop do
p result.join
new_result = []
result.each do |elem|
if elem == new_result.last
new_result[-2] += 1
else
new_result.push(1, elem)
end
end
result = new_result
break if gets == "exit\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment