Skip to content

Commit f91b90a

Browse files
authored
Update ZigZagConversion.java
1 parent 46f8ae2 commit f91b90a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

java/ZigZagConversion.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@ enum Direction {
2626
public String convert(String s, int numRows) {
2727
StringBuilder result = new StringBuilder();
2828

29-
// Initialize the mapping
3029
StringBuilder[] allRows = new StringBuilder[numRows];
31-
for (int i = 0; i < numRows; i++) {
32-
allRows[i] = new StringBuilder();
30+
for (int depth = 0; depth < numRows; depth++) {
31+
allRows[depth] = new StringBuilder();
3332
}
3433

35-
// Build the mapping
3634
helper(s, numRows, allRows, Direction.SOUTH, 0);
3735

38-
// Join the mapping strings together
3936
for (int depth = 0; depth < numRows; depth++) {
4037
result.append(allRows[depth].toString());
4138
}

0 commit comments

Comments
 (0)