Skip to content

Instantly share code, notes, and snippets.

@imouaddine
Created November 13, 2014 15:10
Show Gist options
  • Save imouaddine/57976b4cf677abddf947 to your computer and use it in GitHub Desktop.
Save imouaddine/57976b4cf677abddf947 to your computer and use it in GitHub Desktop.
def hanoi(n, source, intermediary, destination)
if n > 0
hanoi(n-1, source,destination,intermediary)
destination.push(source.pop)
hanoi(n-1, intermediary, source, destination)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment