File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13 Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments