Skip to content

Instantly share code, notes, and snippets.

@tianmingzuo
Created November 6, 2018 16:13
Show Gist options
  • Select an option

  • Save tianmingzuo/993d1866cba09a4414eb805e5ef73361 to your computer and use it in GitHub Desktop.

Select an option

Save tianmingzuo/993d1866cba09a4414eb805e5ef73361 to your computer and use it in GitHub Desktop.
function moveDisk(n, source, buffer, destination){
if(n>=1){
moveDisk(n-1, source, destination, buffer);
console.log("Move one disk from " + source + " to " + destination);
moveDisk(n-1, buffer, source, destination);
}else{
return;
}
}
moveDisk(5, "A", "B", "C");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment