Skip to content

Commit 008953b

Browse files
committed
applied gradle
1 parent 117f0a9 commit 008953b

File tree

1 file changed

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

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ public class Lesson13 {
88
* Provide the solution to LeetCode 3146 here:
99
* https://leetcode.com/problems/permutation-difference-between-two-strings
1010
*/
11-
1211
public int findPermutationDifference(String s, String t) {
13-
14-
//var charLocation = new HashMap<Character, Integer>();
1512

16-
HashMap<Character,Integer> map = new HashMap();
17-
int sum=0;
18-
for(int i =0; i< s.length(); i++) {
19-
map.putIfAbsent(s.charAt(i),i);
13+
// var charLocation = new HashMap<Character, Integer>();
14+
15+
HashMap<Character, Integer> map = new HashMap();
16+
int sum = 0;
17+
for (int i = 0; i < s.length(); i++) {
18+
map.putIfAbsent(s.charAt(i), i);
2019
}
21-
for(char key: map.keySet()) {
22-
int indexInt = t.indexOf(Character.toString(key));
23-
sum += Math.abs (s.indexOf(key)- indexInt);
20+
for (char key : map.keySet()) {
21+
int indexInt = t.indexOf(Character.toString(key));
22+
sum += Math.abs(s.indexOf(key) - indexInt);
2423
}
2524
return sum;
2625
}

0 commit comments

Comments
 (0)