双指针做题总结2(滑动窗口)
窗口大小固定:串联所有单词的子串https://leetcode.cn/problems/substring-with-concatenation-of-all-words/description/?envType=study-plan-v2&envId=top-interview-150
窗口大小不固定:最小覆盖子串 https://leetcode.cn/problems/minimum-window-substring/?envType=study-plan-v2&envId=top-interview-150
76.最小覆盖子串

思路:
双指针滑动窗口问题,指针的移动条件是双指针的核心。
反思:
1、考虑右指针已经移动到最右端,无法继续移动的情况。(flag1的思路)
2、用map.empty()是要千万注意:map[key]相当于往map中添加元素
代码:
见Leecode

浙公网安备 33010602011771号