dsa · medium
Anagram Substring Count
GreyOrangeStringSliding WindowHash Map
Count how many substrings of txt are anagrams of pat.
Arguments
txt— the text to search inpat— the pattern to search for
**Example:** txt="forxxorfxdofr", pat="for" → 3.
Constraints
1 <= len(txt) <= 10^4
Examples
Example 1
Input: forxxorfxdofr for Expected: 3