We’re preparing your current view and syncing the latest data.
Given two strings s1 and s2, write a function to return true if s2 contains a permutation of s1. In other words, one of the first string's permutations is the substring of the second string.
Two strings s1 and s2.
Boolean value true or false.
1 <= s1.length, s2.length <= 10^4; s1 and s2 consist of lowercase English letters.
Example 1
Input
s1 = "ab", s2 = "eidbaooo"
Output
true
Explanation
s2 contains one permutation of s1 "ba" starting at index 3.
Example 2
Input
s1 = "ab", s2 = "eidboaoo"
Output
false
Explanation
There is no permutation of s1 in s2.