LeetCode - Longest Substring Without Repeating Characters
来源:互联网 发布:日本妹子发型 知乎 编辑:程序博客网 时间:2024/04/29 06:20
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
class Solution {public: int lengthOfLongestSubstring(string s) { const int N=256;int max=0,len=0,start=0;vector<int> matrix(N,-1);for(int i=0;i<s.size();i++){if(matrix[s[i]]==-1||matrix[s[i]]<start){len++;}else{start=matrix[s[i]]+1;max=max>len?max:len;len=i-matrix[s[i]];}matrix[s[i]]=i;}return max>len?max:len; }};
- LeetCode: Longest Substring Without Repeating Characters
- LeetCode Longest Substring Without Repeating Characters
- LeetCode: Longest Substring Without Repeating Characters
- [Leetcode] Longest Substring Without Repeating Characters
- leetcode 23: Longest Substring Without Repeating Characters
- [LeetCode] Longest Substring Without Repeating Characters
- LeetCode 3 - Longest Substring Without Repeating Characters
- [LeetCode]Longest Substring Without Repeating Characters
- leetcode Longest Substring Without Repeating Characters
- 【leetcode】 Longest Substring Without Repeating Characters
- LeetCode-Longest Substring Without Repeating Characters
- [LeetCode] Longest Substring Without Repeating Characters
- [LeetCode] Longest Substring Without Repeating Characters
- [leetcode] Longest Substring Without Repeating Characters
- LeetCode - Longest Substring Without Repeating Characters
- LeetCode 3: Longest Substring Without Repeating Characters
- leetcode-3:Longest Substring Without Repeating Characters
- leetcode之Longest Substring Without Repeating Characters
- Ubuntu下的telnet服务
- php 笔记。忘记叫什么表达式了
- Count and Say
- 56py无锡官方网站2013最新
- 黑马程序员——Java高新技术(3)
- LeetCode - Longest Substring Without Repeating Characters
- 自旋锁
- Gulliver's Travels——5、A voyage to Brobdingnag
- Search Insert Position
- AndEngine学习--单帧图片组合成为动画资源
- 线性时间复杂度求数组第n大
- Oracle 死锁的检测查询及处理
- How to properly configure NLB cluster in Windows 2008
- oracle基本文件之参数文件