Skip to content

Commit aebae67

Browse files
authored
Update solution.ts
1 parent ad111b9 commit aebae67

File tree

1 file changed

+0
-3
lines changed
  • src/main/ts/g0401_0500/s0438_find_all_anagrams_in_a_string

1 file changed

+0
-3
lines changed

src/main/ts/g0401_0500/s0438_find_all_anagrams_in_a_string/solution.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function findAnagrams(s: string, p: string): number[] {
1111
const res: number[] = []
1212
let i: number = 0
1313
let j: number = 0
14-
1514
while (i < s.length) {
1615
const idx: number = s.charCodeAt(i) - 'a'.charCodeAt(0)
1716
// Add the new character
@@ -21,15 +20,13 @@ function findAnagrams(s: string, p: string): number[] {
2120
map[s.charCodeAt(j++) - 'a'.charCodeAt(0)]++
2221
}
2322
let finish: boolean = true
24-
2523
for (let k = 0; k < 26; k++) {
2624
// If it is not an anagram of string p
2725
if (map[k] !== 0) {
2826
finish = false
2927
break
3028
}
3129
}
32-
3330
if (i >= p.length - 1 && finish) {
3431
res.push(j)
3532
}

0 commit comments

Comments
 (0)