We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7395e13 commit 78976dbCopy full SHA for 78976db
lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java
@@ -10,14 +10,14 @@ public class Lesson13 {
10
*/
11
public int findPermutationDifference(String s, String t) {
12
HashMap<Character, Integer> hashMap = new HashMap<>();
13
- int pD = 0;
+ int permutationD = 0;
14
for (int i = 0; i < s.length(); i++) {
15
hashMap.put(s.charAt(i), i);
16
}
17
for (char key : hashMap.keySet()) {
18
int indexT = t.indexOf(Character.toString(key));
19
- pD += Math.abs(s.indexOf(key) - indexT);
+ permutationD += Math.abs(s.indexOf(key) - indexT);
20
21
- return pD;
+ return permutationD;
22
23
0 commit comments