Towers of hanoi problem.
3 poles, N discs in decreasing size. (seen bottom to top, usual)
but there is one new condition. There are i number of discs (of same size i) at each ith position. A disc can be placed on top of same or bigger sized disc.
complete the below function to move all discs to another pole.
int getNumMoves(int N)
{
}
You will be given input number N, you have to output number of moves needed.
For ex:
For N = 3 NumMoves is 17
For N = 4 NumMoves is 49
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment