258. Find All Anagram Substrings

Medium · Sliding Window

Given strings `s` and `p`, return all start indices in `s` where an anagram of `p` begins.

Examples

Example 1
Input: s="cbaebabacd", p="abc"
Output: [0, 6]
Explanation: "cba" starts at 0, "bac" starts at 6

Constraints