urlname
type
Post
password
SyncToConfluence
category
Leetcode
date
Apr 13, 2024
slug
01HVC26RYEJD3PZ0G6X2VP3AS9
icon
Button
catalog
summary
tags
Algorithm
滑动窗口
字符串
哈希表
cover
Status
BusyTime
Status 1
status
Published
题目链接
关键词
- 滑动窗口
- 哈希表
- 字符串
解析
- 用一个滑动窗口来记录当前没有重复字符的字符串区间
- 用一个哈希表,来记录滑动窗口内所有的字符,避免在判断窗口内是否有指定字符时的循环
- 在窗口滑动的时候,记录窗口长度的最大值res
- 需要注意的是,在滑动的过程中,如果发现字符已经出现过,也就是在哈希表中已经存在,需要将窗口左端的字符移除出哈希表,并向右移动窗口的左边界
代码
- Author:CoderWdd
- URL:https://www.wuinsights.top//article/01HVC26RYEJD3PZ0G6X2VP3AS9
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts
