[LeetCode C++实现]567. Permutation in String
使用滑动窗口算法求解该问题答案:
class Solution {
public:
bool checkInclusion(string s1, string s2) {
unordered_map<char,int> need,window;
//构建需要匹配的字符map
for(auto c:s1) need[c] += 1;
int left = 0,right = 0,match_cnt = 0;
while(right < s2.size()){
char c = s2[right];
right++;
if(need.count(c))
{
window[c......