当前位置:网站首页>Sliding window frame
Sliding window frame
2022-07-22 15:38:00 【UniversalNature】
come from I wrote a poem , Turn the sliding window algorithm into a dictation problem
/* Sliding window algorithm framework */
void slidingWindow(string s) {
unordered_map<char, int> window;
int left = 0, right = 0;
while (right < s.size()) {
// c Is the character that will be moved into the window
char c = s[right];
// Increase the window
right++;
// Make a series of updates to the data in the window
...
/*** debug Output position ***/
printf("window: [%d, %d)\n", left, right);
/********************/
// Determine whether the left window should shrink
while (window needs shrink) {
// d Is the character that will be moved out of the window
char d = s[left];
// contract the window
left++;
// Make a series of updates to the data in the window
...
}
}
}
边栏推荐
- Let security move | no matter what industry network architecture, these six tactics win the target
- [Huawei machine test questions] maximum number of components [2022 Q3 | 100 points]
- codeforces每日5题(均1500)-第二十二天
- 单调栈框架
- [information collection] write data from fofa API interface into txt and excel
- PLT draw and save the results
- 云原生IDE:iVX首个通用且强大无代码开发平台
- 【华为机试真题】组成最大数【2022 Q3 | 100分】
- 【06】指令跳转:原来if...else就是goto
- Values swxxdp calculation in Res
猜你喜欢
华为云从入门到实战 | AI云开发ModelArts入门与WAF应用与部署
Seaborn barplot drawing summary
Kubernetes basic part learning notes
Tdengine experimental cluster establishment success
Let security move | no matter what industry network architecture, these six tactics win the target
Add, delete, check and modify MySQL (second sentence)
时序数据库
深度学习之 8 深度模型优化与正则化
temporal database
Pyside2 as a simple browser
随机推荐
cookie和session
Codeworks 5 questions per day (average 1500) - day 22
【C语言-文件】数据终于可以出内存,到外面的世界看看了/(ㄒoㄒ)/~~
AutoLabel(自动标签)
K-means clustering modeling and programming
[07] function call: why does stack overflow happen?
Leetcode exercise 1 - binary tree pruning
Accelerate the construction of standard system and promote the high-quality development of data security industry
欢乐的彝族火把节Joyous Torch Festival of the Yi Nationality
时序数据库
plt 画图并保存结果
9个好习惯提高你的幸福感
How to select current probe
Machine learning notes - overview of machine learning system design process
对原数组有影响的几个方法
[Huawei machine test questions] maximum number of components [2022 Q3 | 100 points]
Redis高可用原理 主从哨兵集群
For more than 20 years, how has classified protection "kept pace with the times"?
【医学分割】Medical Image Segmentation Using Deep Learning: A Survey
FPGA image processing learning face recognition