Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create towerofhanoi.java #351

Merged
merged 1 commit into from
Oct 2, 2021
Merged

Conversation

Prakhar-creator
Copy link
Contributor

Problem

Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:

  1. Only one disk can be moved at a time.
  2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
  3. No disk may be placed on top of a smaller disk.

Solution

Code has been attached in java

… we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules: 1) Only one disk can be moved at a time. 2) Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack. 3) No disk may be placed on top of a smaller disk.
@fineanmol
Copy link
Owner

Hi @Prakhar-creator , Please add your name to the Contribution.html file. ✨

@fineanmol fineanmol merged commit a1d83ae into fineanmol:master Oct 2, 2021
@fineanmol fineanmol added hacktoberfest-accepted Accept for hacktoberfest, will merge later and removed Name missing in Contribution.html labels Oct 2, 2021
@Prakhar-creator
Copy link
Contributor Author

Thank you sir!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accept for hacktoberfest, will merge later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants