567. Permutation in String

Practice Permutation in String for free on NudgeCode: Medium, Sliding Window pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return true if some contiguous piece of s2 is a rearrangement of s1 (same letters with the same counts), otherwise false.

Example

s1 = "ab", s2 = "eidbaooo"  ->  true    ("ba")
s1 = "ab", s2 = "eidboaoo"  ->  false

Constraints