Skip to content

Commit 6052da3

Browse files
committed
fix: Changed Map variable name for easier readability
1 parent fa40e21 commit 6052da3

File tree

1 file changed

+3
-3
lines changed
  • lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13

1 file changed

+3
-3
lines changed

lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ public class Lesson13 {
1515
* 2 the math: |0 - 1| + |1 - 0| + \2 - 2| = |-1| + |1| + |0| = 1 + 1 + 0 = 2 we return 2
1616
*/
1717
public int findPermutationDifference(String s, String t) {
18-
var compareStrings = new HashMap<Character, Integer>();
18+
var stringMap = new HashMap<Character, Integer>();
1919
int total = 0;
2020

2121
for (int i = 0; i < s.length(); i++) {
22-
compareStrings.put(s.charAt(i), s.indexOf(s.charAt(i)));
22+
stringMap.put(s.charAt(i), s.indexOf(s.charAt(i)));
2323
}
2424

2525
for (int i = 0; i < t.length(); i++) {
26-
int absDiff = Math.abs(compareStrings.get(s.charAt(i)) - t.indexOf(s.charAt(i)));
26+
int absDiff = Math.abs(stringMap.get(s.charAt(i)) - t.indexOf(s.charAt(i)));
2727
total += absDiff;
2828
}
2929
return total;

0 commit comments

Comments
 (0)