一、基本概念 1.窗口分类 TimeWindow:按照时间生成 Window。对于 TimeWindow,可以根据窗口实现原理的不同分成三类:滚动窗口(TumblingWindow)、滑动窗口(Sliding Window)和会话窗口(Session Window)。 CountWindow:按照指 ...
题目描述 Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the ...
1.无重复字符的最长子串 这题需要用到滑动窗口法,有许多问题都可以考虑使用滑动窗口法:https://www.geeksforgeeks.org/tag/sliding-window/ 因为用c++,所以用到set容器:std::count 2.删除排序链表中的重复元素II 3.加一 1 class ...
分类:
编程语言 时间:
2020-04-11 18:14:57
阅读次数:
69
题目链接 "https://leetcode cn.com/problems/sliding window maximum/" 题目内容 给定一个数组 nums,有一个大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 k 个数字。滑动窗口每次只向右移动一位。 返回滑 ...
分类:
编程语言 时间:
2020-02-11 09:22:59
阅读次数:
79
最长无重复字符的子串。 题意是给一个input字符串,请输出其最长的,没有重复字符的substring。这是two pointer/sliding window的基础题。例子 Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ...
分类:
其他好文 时间:
2020-01-14 09:18:01
阅读次数:
72
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, MovingAverage m = new M ...
分类:
移动开发 时间:
2019-12-12 14:56:35
阅读次数:
127
Template from https://leetcode.com/problems/minimum-window-substring/discuss/26808/Here-is-a-10-line-template-that-can-solve-most-'substring'-problems ...
滑动窗口 滑动窗口(sliding windows algorithm)这种方法,专门用于解决区间解的问题。它在运算的时候,将解集放在窗口中,结束的时候比对是否符合预期。在运算的过程中,会对窗口的左右边缘进行操作(扩大、缩小)。特别针对于线性输入解决,滑动窗口就很形象了。 30. Substring ...
分类:
其他好文 时间:
2019-11-15 12:14:42
阅读次数:
57
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num ...
滑动窗口的发送窗口示意图如下,其中由对端通告的窗口窗口大小为6,窗口中和窗口外的数据分别表示为:1-3发送并已经被确认的数据段,4-6发送但尚未被确认的数据段,7-9能够发送尚未发送的数据段,10-…位于窗口外不能够被发送的数据; 窗口边沿的移动示意图如下,当接收方确认数据后,这个滑动窗口不时的向右 ...