Coding

Count Anagrammatic Substrings

Count the number of anagrammatic substrings from one string present in another.

Input: s = "abab", p = "ab"

Output: [0, 1, 2]

Explanation: The substrings "ab", "ba", and "ab" starting at indices 0, 1, and 2 respectively are all anagrams of the string "ab".

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions