Sliding WindowMedium

Permutation in String

Return true if some contiguous part of text uses exactly the letters of pattern, in any order.

Example 1pattern = "ab", text = "xxbax" → true"ba" is in the text.
Example 2pattern = "ab", text = "axxb" → false
1 ≤ lengths ≤ 10⁴ · lowercase English letters

Hints

0 of 3 open
Hint 2 · the patternHint 3 · the key line