滑动窗口模板
Leetcode 1004
Leetcode 1838
int x;
for(int r = 0; r < n; ++r) {
update(x, r); //update x because r increased by 1, window size + 1
while(is_break(x)) {
update(x, l++);
}
}
Good reference: https://leetcode.com/problems/frequency-of-the-most-frequent-element/discuss/1175088/C%2B%2B-Maximum-Sliding-Window-Cheatsheet-Template!