Permutation in String
mediumCheck if one string contains a permutation of another
Permutation in String
Key Insight
Fixed window of s1.length over s2. Window is a permutation when character frequencies match
Step 1Build Target Frequency
s1 = 'ab'Need: a:1, b:1
e
0i
1d
2b
3a
4o
5o
6o
7Count character frequencies of s1 to know what to match.
1 / 5