Medium · Strings
Find anagram substring indices
Given strings s and p of lowercase letters, return, in increasing order, every index i such that the substring of s of length |p| starting at i is an anagram of p (the same letters with the same counts); return an empty list if there is none.
Examples
Example 1
s="cbaebabacd", p="abc"Output: starts [0,6]
Example 2
s="abab", p="ab"Output: starts [0,1,2]
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.