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 #64

Open
ravikr126 opened this issue Jan 11, 2021 · 1 comment
Open

TOWER OF HANOI #64

ravikr126 opened this issue Jan 11, 2021 · 1 comment

Comments

@ravikr126
Copy link
Contributor

Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move all disks from source rod to destination rod using a third rod (say auxiliary). The rules are :

  1. Only one disk can be moved at a time.
  2. A disk can be moved only if it is on the top of a rod.
  3. No disk can be placed on top of a smaller disk.
    Print the steps required to move n disks from source rod to destination rod.
    Source Rod is named as 'a', auxiliary rod as 'b', and destination rod as 'c'.
    Input Format :
    Integer n
    Output Format :
    Steps in different lines (in one line print source and destination rod name separated by space)
    Constraints :
    0 <= n <= 20
    Sample Input 1 :
    2
    Sample Output 1 :
    a b
    a c
    b c
    Sample Input 2 :
    3
    Sample Output 2 :
    a c
    a b
    c b
    a c
    b a
    b c
    a c

I WILL USE CPP FOR SOLVE THIS ISSUE

@sammy8825
Copy link

Can i work on this issue?

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

No branches or pull requests

2 participants