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 ad111b9 commit aebae67Copy full SHA for aebae67
src/main/ts/g0401_0500/s0438_find_all_anagrams_in_a_string/solution.ts
@@ -11,7 +11,6 @@ function findAnagrams(s: string, p: string): number[] {
11
const res: number[] = []
12
let i: number = 0
13
let j: number = 0
14
-
15
while (i < s.length) {
16
const idx: number = s.charCodeAt(i) - 'a'.charCodeAt(0)
17
// Add the new character
@@ -21,15 +20,13 @@ function findAnagrams(s: string, p: string): number[] {
21
20
map[s.charCodeAt(j++) - 'a'.charCodeAt(0)]++
22
}
23
let finish: boolean = true
24
25
for (let k = 0; k < 26; k++) {
26
// If it is not an anagram of string p
27
if (map[k] !== 0) {
28
finish = false
29
break
30
31
32
33
if (i >= p.length - 1 && finish) {
34
res.push(j)
35
0 commit comments