Created
November 13, 2014 15:10
-
-
Save imouaddine/57976b4cf677abddf947 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
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