Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Keep a fixed-size window of length p.length over s. Compare window character frequency to p's frequency at each step and record matching start indices.
A substring is an anagram of p exactly when all character counts match. Sliding updates only two character counts per step.
Updated Feb 2026