Skip to content

Commit 2fb9ff2

Browse files
committed
feat: completes lesson 13
1 parent abb394d commit 2fb9ff2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lesson_13/maps_ts/src/lesson13.ts

Lines changed: 7 additions & 1 deletion
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;
6+
let difference = 0;
7+
for (let i = 0; i < s.length; i++) {
8+
//for loop is to itirate through the string
9+
difference += Math.abs(i - t.indexOf(s[i])); // Add absolute differences using an Indexof function
10+
// Co pilot fixed my error. I had charAt originally it would not pass
11+
}
12+
return difference;
713
}

0 commit comments

Comments
 (0)