Window with Anagram Exists - aloalgo

Window with Anagram Exists

Medium

You are given two strings s and p, return true if s contains a substring that is an anagram of p, and false otherwise.An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. For example, "listen" is an anagram of "silent".

Example 1

Inputs
s = "eidbaooo"
p = "ab"
Output
True
Explanation:

The substring "ba" in "eidbaooo" is an anagram of "ab".

Example 2

Inputs
s = "eidboaoo"
p = "ab"
Output
False
Explanation:

No substring in "eidboaoo" is an anagram of "ab".

Example 3

Inputs
s = "abc"
p = "bac"
Output
True
Explanation:

The string "abc" contains itself, which is an anagram of "bac".

Loading...
Inputs
s = "eidbaooo"
p = "ab"
Output
True

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!