How to count moves in Hanoi without global variables or modifying the function?
I’m working on solving the Tower of Hanoi problem and need to count the total number of moves required for n disks. Currently, I’ve implemented a solution where the move count is tracked using a global variable, but I’d like to refactor this code to eliminate the use of global variables without altering the function signature.