Skip to content

Commit a71f743

Browse files
Fixed some errors
1 parent 05435c6 commit a71f743

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
public final class TowerOfHanoi {
2323

2424
private TowerOfHanoi() {
25-
2625
// Utility class
2726
}
2827

@@ -36,10 +35,10 @@ private TowerOfHanoi() {
3635
* @return list of moves as strings
3736
*/
3837
public static List<String> solveTowerOfHanoi(int n, char source, char destination, char auxiliary) {
39-
List<String> moves = new ArrayList<>();
4038
if (n < 0) {
4139
throw new IllegalArgumentException("Number of disks cannot be negative");
4240
}
41+
List<String> moves = new ArrayList<>();
4342
moveDisks(n, source, destination, auxiliary, moves);
4443
return moves;
4544
}

0 commit comments

Comments
 (0)