0003. 无重复字符的最长子串 #251
Replies: 1 comment
-
|
这个题目的关键是这里 while window[s[right]] > 1:
window[s[left]] -= 1
left += 1表示如果右边有重复的字符出现了,比如 a 出现两次,窗口的左边要一直 while 循环到第一个 a 的右边才停止, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
0003. 无重复字符的最长子串
--- 0003. 无重复字符的最长子串 标签:哈希表、字符串、滑动窗口 难度:中等 题目链接 0003. 无重复字符的最长子串 - 力扣 题目大意 描述:给定一个字符串 s。 要求:找出其中不含有重复字符的最长子串的长度。 说明: 0≤s.length≤5∗104。 s 由英文字母、数字、符号和空格组成。 示例: 示例 1: 示例 2: 解题思路 思...
https://algo.itcharge.cn/solutions/0001-0099/longest-substring-without-repeating-characters/
Beta Was this translation helpful? Give feedback.
All reactions