If you have to move n disks from the source peg to the destination peg, there is an elegant recursive solution:
if n = 1, just move 1 disk from the source peg to the destination peg otherwise move n-1 disks from the source peg to the intermediate peg move 1 disk from the source peg to the destination peg move n-1 disks from the intermediate peg to the destination peg