Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutations is a substring of s2.
Example 1
Input: s1 = ab, s2 = eidbaooo
Output: true
Explanation: The substring "ba" starting at index 3 of "eidbaooo" uses the same letters as "ab", so s2 contains a permutation of s1.
Example 2
Input: s1 = ab, s2 = eidboaoo
Output: false
Explanation: The 2-letter windows of "eidboaoo" are ei, id, db, bo, oa, ao and oo. None of them is "ab" or "ba".
Example 3
Input: s1 = a, s2 = ab
Output: true
Explanation: "a" appears in "ab" at index 0, and a single letter is its own permutation.
A permutation of s1 is any window in s2 of length len(s1) whose letter frequencies exactly match s1's. Slide a fixed-width window and compare counts.
Run checks all cases above. Submit evaluates all test cases.