[LeetCode C++实现]438. Find All Anagrams in a String
使用滑动窗口算法求解:
class Solution {
public:
vector<int> findAnagrams(string s, string p) {
vector<int> res;
unordered_map<char,int> need,window;
int left = 0,right = 0,match_cnt = 0;
//更新需要命中的全部字符
for(auto c:p) need[c] += 1;
while(right < s.size()){
char c = s[right];
right++;
if(n......