Every place an anagram starts
Given a string s and a non-empty string p, both made of lowercase letters, return every index i such that the substring of s that starts at i and has length len(p) is a rearrangement of p: the same letters, the same number of times, in any order. Return the indices in increasing order; overlapping matches all count. If p is longer than s, return [].
Aim for O(len(s) + len(p)) time.
Besides the tests, one large input (8,000-letter s, 3,000-letter p) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
anagram_starts("dogodgxgod", "god")→[0,2,3,7]anagram_starts("abab", "ab")→[0,1,2]anagram_starts("hello", "xyz")→[]