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

Tower of Hanoi #140

Open
suryaprakashpandey opened this issue Oct 2, 2023 · 7 comments
Open

Tower of Hanoi #140

suryaprakashpandey opened this issue Oct 2, 2023 · 7 comments

Comments

@suryaprakashpandey
Copy link
Collaborator

Write code in the preferred language and attach output with it.

The Tower of Hanoi game consists of three stacks (left, middle and right) and n round disks of different sizes. Initially, the left stack has all the disks, in increasing order of size from top to bottom.

The goal is to move all the disks to the right stack using the middle stack. On each move you can move the uppermost disk from a stack to another stack. In addition, it is not allowed to place a larger disk on a smaller disk.

Your task is to find a solution that minimizes the number of moves.

Input
The only input line has an integer n: the number of disks.

Output
First print an integer k: the minimum number of moves.

After this, print k lines that describe the moves. Each line has two integers a and b: you move a disk from stack a to stack b.

Example:

Input: 2
Output:
3
1 2
1 3
2 3

@Subhashini014
Copy link

hello @suryaprakashpandey could you please assign me this issue currently I am preparing Data Structures and Algorithms using java it would be very helpful to me if assign this issue to me.

@Harikaran1729
Copy link

Hello @suryaprakashpandey ... Could you please assign me this issue? I am currently a beginner to Opensource and I am learning C programming. I wish to contribute to this issue. Thank you!!

@asryan11
Copy link

asryan11 commented Oct 4, 2023

See PR #157

@siya100
Copy link

siya100 commented Oct 4, 2023

hey @suryaprakashpandey!!!
can you please assign me this issue as currently i am learning dsa in python and it would be a great practice

@Mani1881
Copy link

hey @saakshii12 can u please assign this issue to me.i will write in java

@vaishnavim141003
Copy link

I would like to work on this issue using python language .
Name-Vaishnavi Mahajan.(UIN2022739)
Cummins college of engineering.(SY)
Can you please assign this issue to me .

vaishnavim141003 added a commit to vaishnavim141003/Competitive-Programming-2023-GDSC-CUMMINS-X-GDSC-MMCOE that referenced this issue Oct 31, 2023
vaishnavim141003 added a commit to vaishnavim141003/Competitive-Programming-2023-GDSC-CUMMINS-X-GDSC-MMCOE that referenced this issue Oct 31, 2023
@vaishnavim141003
Copy link

vaishnavim141003 commented Oct 31, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants