Answers for "what do you mean by tower of hanoi?"

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 "what do you mean by tower of hanoi?"

Browse Popular Code Answers by Language