Skip to content

Commit f2f889d

Browse files
committed
final fixes
1 parent ae51b5a commit f2f889d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Dynamic Programming/zigzag_conversion.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static String convert(String s, int numRows) {
4747
if (numRows <= 1)
4848
return s;
4949
else {
50-
// traversing in zig zag pattern and storing the data of each row in hashtable as string
50+
// traversing in zig zag pattern and storing the data of each row in hash map as string
5151
for (int x = 0; x < s.length(); x++) {
5252
char ch1 = s.charAt(x);
5353
String ch = Character.toString(ch1);
@@ -62,25 +62,25 @@ public static String convert(String s, int numRows) {
6262
} else {
6363
map.put(pos, ch);
6464
}
65-
// once reached the end of the row start moving upwards i.e decreasing the key in hash table
65+
// once reached the end of the row start moving upwards i.e decreasing the key in hash map
6666
pos--;
6767
}
6868
else if (pos == 0 || flag == 0) {
6969
flag = 0;
70-
// check if the key in hash table has some data present
70+
// check if the key in hash map has some data present
7171
if (map.containsKey(pos)) {
7272
String a = map.get(pos);
7373
String w = a + ch;
7474
map.put(pos, w);
7575
} else {
7676
map.put(pos, ch);
7777
}
78-
// keep increasing the key i.e pos in hash table till we reach at the end of the row
78+
// keep increasing the key i.e pos in hash map till we reach at the end of the row
7979
pos++;
8080
}
8181
}
8282
for (Map.Entry < Integer, String > e: map.entrySet())
83-
// concatinate the values of each row of hash table
83+
// concatinate the values of each row of hash map
8484
word = word + e.getValue();
8585

8686
return word;

0 commit comments

Comments
 (0)