← Visualizers
Sliding Window — Frequency LeetCode 438

Find All Anagrams in a String / visualized

The exact same machinery as Permutation in String — a fixed window of length p.length whose character counts must match p's. The only difference: instead of returning true at the first match, record every start index and keep going.

Execution

idle
need (from p)  vs  window (current)
Press Run to begin.
0 / 0
Speed

Java · running line

window need mismatch anagram found
O(n) time · O(1) space (26 letters)  ·  identical to Permutation in String — the loop just doesn't early-return.