Skip to content

Commit 373e52e

Browse files
committed
feat: added lesson13 homework brute-force implementation by Yemi
1 parent 39c8f59 commit 373e52e

File tree

1 file changed

+7
-6
lines changed
  • lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13

1 file changed

+7
-6
lines changed
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package com.codedifferently.lesson13;
22

33
public class Lesson13 {
4-
5-
/**
6-
* Provide the solution to LeetCode 3146 here:
7-
* https://leetcode.com/problems/permutation-difference-between-two-strings
8-
*/
94
public int findPermutationDifference(String s, String t) {
10-
return 0;
5+
int result = 0;
6+
int strLen = s.length();
7+
for(int i= 0; i < strLen ; i++){
8+
char ch = s.charAt(i);
9+
result = result + ( Math.abs(s.indexOf(ch) - t.indexOf(ch)));
10+
}
11+
return result;
1112
}
1213
}

0 commit comments

Comments
 (0)