LeetCode--3.无重复字符的最长子串
2019-08-24 19:57
141 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_42918934/article/details/100056524
LeetCode–3.无重复字符的最长子串
难度 中等
题目描述:给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。
var lengthOfLongestSubstring = function(s) { if(s === "") return 0; var set = new Set([s[0]]); let length = s.length; let max = 1; let [left,right] = [0,1]; while(right < length){ while(set.has(s[right])){ let temp = set.size; max = (max>temp) ? max : temp; set.delete(s[left]); left++; } set.add(s[right]); right++; } return (max<set.size) ? set.size : max; };
相关文章推荐
- LeetCode题解(python)-3.无重复字符的最长子串
- LeetCode 3. 无重复字符的最长子串
- 【Leetcode】3. 无重复字符的最长子串[未解出]
- LeetCode-3.无重复字符的最长子串
- leetcode 3. 无重复字符的最长子串(Java 版)
- LeetCode 3. 无重复字符的最长子串
- 【LeetCode】3.无重复字符的最长子串 结题报告 (C++)
- 【Leetcode一刷】3.无重复字符的最长子串
- LeetCode 3. 无重复字符的最长子串 Python
- 【leetcode每日一题】【2019-04-10】3.无重复字符的最长子串
- Leetcode(C++)——3. 无重复字符的最长子串
- Leetcode 3.无重复字符的最长子串
- LeetCode3. 无重复字符的最长子串(Java)
- Leetcode——3.无重复字符的最长子串
- Leetcode刷题35-3.无重复字符的最长子串(C++)
- Leetcode 3. 无重复字符的最长子串
- 【LeetCode】3. 无重复字符的最长子串(Longest Substring Without Repeating Characters,24.2%,中等)
- LeetCode 3. 无重复字符的最长子串
- leetcode 3. 无重复字符的最长子串
- Leetcode:3.无重复字符的最长子串