-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsliding-window.js
92 lines (89 loc) · 2.32 KB
/
sliding-window.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import windowLogo from "../imgs/window.svg";
export default {
title: "滑动窗口",
logo: windowLogo,
list: [
{
text: "固定窗口(伪代码)",
problems: [
{
title: "438. 找到字符串中所有字母异位词",
id: "find-all-anagrams-in-a-string",
},
],
codes: [
{
language: "py",
text: `
初始化前��指针 = 0
初始化 ans
for 前指针 in 可迭代集合
更新窗口内信息(前指针进窗口,后指针出窗口)
后指针移动
更新答案
返回 ans
`,
},
],
},
{
text: "可变窗口(伪代码)",
problems: [
{
id: "longest-substring-without-repeating-characters",
title: "3. 无重复字符的最长子串",
},
{
title: "76. 最小覆盖子串",
id: "minimum-window-substring",
},
{
title: "209. 长度最小的子数组",
id: "minimum-size-subarray-sum",
},
{
id: "fruit-into-baskets",
title: "904. 水果成篮",
},
{
title: "930. 和相同的二元子数组",
id: "binary-subarrays-with-sum",
},
{
title: "992. K 个不同整数的子数组",
id: "subarrays-with-k-different-integers",
},
{
title: "1004. 最大连续 1 的个数 III",
id: "max-consecutive-ones-iii",
},
{
title: "1234. 替换子串得到平衡字符串",
id: "replace-the-substring-for-balanced-string",
},
{
title: "1248. 统计「优美子数组」",
id: "count-number-of-nice-subarrays",
},
],
codes: [
{
language: "py",
text: `
初始化慢指针 = 0
初始化 ans
for 快指针 in 可迭代集合
更新窗口内信息
while 窗口内不符合题意
扩展或者收缩窗口
慢指针移动
更新答案
返回 ans
`,
},
],
},
],
link:
"https://github.com/azl397985856/leetcode/blob/master/thinkings/slide-window.md",
};