Answers for "tower of hanoi implementation"

C++
0

tower of hanoi

/// find total number of steps 
int towerOfHanoi(int n) {
  /// pow(2,n)-1
  if (n == 0) return 0;
  
  return towerOfHanoi(n - 1) + 1 + towerOfHanoi(n - 1);
}
Posted by: Guest on April-04-2021

Code answers related to "tower of hanoi implementation"

Browse Popular Code Answers by Language