Skip to content

Commit 9358c52

Browse files
committed
feat:updates hasmap names
1 parent b83de9f commit 9358c52

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lesson_13/maps_java/maps_app/src/main/java/com/codedifferently/lesson13/Lesson13.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ public class Lesson13 {
99
* https://leetcode.com/problems/permutation-difference-between-two-strings
1010
*/
1111
public int findPermutationDifference(String s, String t) {
12-
var bmb = new HashMap<Character, Integer>();
12+
var sIndexByChar = new HashMap<Character, Integer>();
1313
int permDiff = 0;
1414
for (int i = 0; i < s.length(); i++) {
15-
bmb.put(s.charAt(i), i);
15+
sIndexByChar.put(s.charAt(i), i);
1616
}
17-
for (char key : bmb.keySet()) {
17+
for (char key : sIndexByChar.keySet()) {
1818
int indexInT = t.indexOf(Character.toString(key));
1919
permDiff += Math.abs(s.indexOf(key) - indexInT);
2020
}

lesson_13/maps_ts/src/lesson13.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* https://leetcode.com/problems/permutation-difference-between-two-strings
44
*/
55
export function findPermutationDifference(s: string, t: string): number {
6-
const bmb = new Map<string, number>();
6+
const sIndexByChar = new Map<string, number>();
77
let permDiff = 0;
88
for (let i = 0; i < s.length; i++) {
9-
bmb.set(s.charAt(i), i);
9+
sIndexByChar.set(s.charAt(i), i);
1010
}
11-
for (const key of bmb.keys()) {
11+
for (const key of sIndexByChar.keys()) {
1212
const indexInT = t.indexOf(key);
1313
permDiff += Math.abs(s.indexOf(key) - indexInT);
1414
}

0 commit comments

Comments
 (0)