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 32f5984 commit 4bb2ad7Copy full SHA for 4bb2ad7
lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java
@@ -7,6 +7,15 @@ public class Lesson13 {
7
* https://leetcode.com/problems/permutation-difference-between-two-strings
8
*/
9
public int findPermutationDifference(String s, String t) {
10
- return 0;
+
11
+ int sumDifference = 0;
12
+ for (int i = 0; i < s.length(); i++) {
13
+ char currentChar = s.charAt(i);
14
+ int indexInT = t.indexOf(currentChar);
15
+ int difference = Math.abs(i - indexInT);
16
+ sumDifference += difference;
17
+ }
18
+ System.out.println("Here is the Permutation Difference is: + letters.get");
19
+ return sumDifference;
20
}
21
0 commit comments