![]() |
VOOZH | about |
Given two strings S1 and S2, the task is to check if S2 contains an anagram of S1 as its substring.
Examples:
Input: S1 = "ab", S2 = "bbpobac"
Output: Yes
Explanation: String S2 contains anagram "ba" of S1 ("ba").Input: S1 = "ab", S2 = "cbddaoo"
Output: No
Approach: Follow the steps below to solve the problem:
Below is the implementation of the above approach:
YES
Time Complexity: O(26 * len(S2))
Auxiliary Space: O(26)