Permutation in String
MediumSliding Window
Decode it first. Clues, constraints, pattern and plan before any code.Given two strings s1 and s2, return true if s2 contains a contiguous substring that is a rearrangement of s1 (same letters, same counts), and false otherwise.
s1 = "ab", s2 = "eidbaooo" → true ("ba")
s1 = "ab", s2 = "eidboaoo" → false
s1 = "adc", s2 = "dcda" → true ("cda")Constraints
1 <= s1.length, s2.length <= 10^4s1ands2consist of lowercase English letters.