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 e234bf5 commit f4d679cCopy full SHA for f4d679c
lesson_13/maps_ts/src/lesson13.ts
@@ -3,5 +3,11 @@
3
* https://leetcode.com/problems/permutation-difference-between-two-strings
4
*/
5
export function findPermutationDifference(s: string, t: string): number {
6
- return 0;
7
-}
+ let result = 0;
+ 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