Skip to content

Commit c22c3d0

Browse files
author
jjcapparell
committed
fix: lesson13.ts edits to pass npm testing
1 parent a1637c4 commit c22c3d0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lesson_13/maps_ts/src/lesson13.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export function findPermutationDifference(s: string, t: string): number {
2-
const stringS: Map<string, number> = new Map();
2+
const stringS = new Map<string, number>();
33
for (let i = 0; i < s.length; i++) {
44
stringS.set(s.charAt(i), i);
55
}
66

7-
const stringT: Map<string, number> = new Map();
7+
const stringT = new Map<string, number>();
88
for (let i = 0; i < t.length; i++) {
99
stringT.set(t.charAt(i), i);
1010
}
@@ -16,7 +16,9 @@ function compareMaps(map1: Map<string, number>, map2: Map<string, number>): numb
1616
let diffSum = 0;
1717
for (const key of map1.keys()) {
1818
if (map2.has(key)) {
19+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1920
const value1 = map1.get(key)!; // Non-null assertion because we checked with has()
21+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2022
const value2 = map2.get(key)!; // Non-null assertion
2123
const difference = Math.abs(value1 - value2);
2224
diffSum += difference;

0 commit comments

Comments
 (0)