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 39c8f59 commit 373e52eCopy full SHA for 373e52e
lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java
@@ -1,12 +1,13 @@
1
package com.codedifferently.lesson13;
2
3
public class Lesson13 {
4
-
5
- /**
6
- * Provide the solution to LeetCode 3146 here:
7
- * https://leetcode.com/problems/permutation-difference-between-two-strings
8
- */
9
public int findPermutationDifference(String s, String t) {
10
- return 0;
+ int result = 0;
+ int strLen = s.length();
+ for(int i= 0; i < strLen ; i++){
+ char ch = s.charAt(i);
+ result = result + ( Math.abs(s.indexOf(ch) - t.indexOf(ch)));
+ }
11
+ return result;
12
}
13
0 commit comments