Can anyone help me with Task on String Counting from MNM Online Programming Contest?

Hello friends can someone tell me how to approach this problem ??

My solution :: Approach was to make a list of all possible permutations and then check for it’s presence in the string given but it 's giving wrong answer .

@vijju123 @kaushal101 @mohit_negi @taran_1407 @vivek_1998299 @meooow @john_smith_3

Thanks in advance :slight_smile:

Since we want to count frequency of any permutation of W, we just need to check for frequecny of each element.

See, if w is “aaab”, then our answer will be number of stubstring of s of length 4, which have same frequency of all characters. This can be done using sliding window and frequency array.

Ur solution is correct, but very slow. Also, u need to count occurances. Increase answer by no of occurances of i in b, not by 1.

Will look into it.