Skip to content

Commit f4d679c

Browse files
committed
feat: Added typescript implementation of lesson13 by Yemi
1 parent e234bf5 commit f4d679c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lesson_13/maps_ts/src/lesson13.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
* https://leetcode.com/problems/permutation-difference-between-two-strings
44
*/
55
export function findPermutationDifference(s: string, t: string): number {
6-
return 0;
7-
}
6+
let result = 0;
7+
const strLen: number = s.length;
8+
for (let i = 0; i < strLen; i++) {
9+
const ch: string = s.charAt(i);
10+
result = result + Math.abs(s.indexOf(ch) - t.indexOf(ch));
11+
}
12+
return result;
13+
}

0 commit comments

Comments
 (0)