Skip to content

Commit 1e0e407

Browse files
Fix clang-format issues in Tower of Hanoi
1 parent 2b50b29 commit 1e0e407

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/com/thealgorithms/recursion/TowerOfHanoi.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,22 @@ private TowerOfHanoi() {
1212
// Utility class
1313
}
1414

15+
/**
16+
* Solves the Tower of Hanoi problem.
17+
*
18+
* @param n number of disks
19+
* @param src source rod
20+
* @param helper auxiliary rod
21+
* @param dest destination rod
22+
*/
1523
public static void towerOfHanoi(int n, char src, char helper, char dest) {
1624
if (n == 1) {
17-
System.out.println("Move disk " + n + " from " + src + " to " + dest);
25+
System.out.println("Move disk 1 from " + src + " to " + dest);
1826
return;
1927
}
2028

2129
towerOfHanoi(n - 1, src, dest, helper);
2230
System.out.println("Move disk " + n + " from " + src + " to " + dest);
2331
towerOfHanoi(n - 1, helper, src, dest);
2432
}
25-
}
26-
33+
}

0 commit comments

Comments
 (0)