Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 3

Welcome to the forum @Nuir

h is the difference between a number and the next one in the sequence

So the difference between a and the next one, b, is b - a.

For example, starting at 3, the next in the sequence is 2.
So 2 - 3 equals -1

If the difference is positive, the sequence increments.
If the difference is negative, the sequence decrements.

Happy coding

2 Likes