> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0567_permutation_in_string/slt.md).

# 思路1 滑动窗口 + hash

一个hash表记录窗口个每个字符应该出现的个数

用s1中的各个字符来初始化hash表

* > 0, 表示s2窗口中还应该出现多少次
* \== 0，说明s1中的字符用完了刚好
* < 0, 说明s2中窗口的已经出现了过多的那个字符
