leetcode-3. Longest Substring Without Repeating Characters
2017-06-02 21:55
477 查看
https://leetcode.com/problems/longest-substring-without-repeating-characters/#/description
代码如下:
代码如下:
public class Solution { public int lengthOfLongestSubstring(String s) { Set<Character> set=new HashSet<>(); int max=0,j=0,i=0; while(j<s.length()) { if(!set.contains(s.charAt(j))) { set.add(s.charAt(j++)); // j++; max=Math.max(max,set.size()); }else { //j++; set.remove(s.charAt(i++)); } } return max; } }
相关文章推荐
- [leetcode]3. Longest Substring Without Repeating Characters
- [LeetCode] 3. Longest Substring Without Repeating Characters
- Leetcode——3. Longest Substring Without Repeating Characters
- leetcode 3. Longest Substring Without Repeating Characters
- LeetCode 3. Longest Substring Without Repeating Characters
- leetcode --3. Longest Substring Without Repeating Characters
- [LeetCode]3. Longest Substring Without Repeating Characters
- leetcode 3. Longest Substring Without Repeating Characters
- [LeetCode] 3. Longest Substring Without Repeating Characters
- [LeetCode]3. Longest Substring Without Repeating Characters
- leetcode3. Longest Substring Without Repeating Characters
- 【Leetcode】3. Longest Substring Without Repeating Characters
- LCP003 LeetCode 3. Longest Substring Without Repeating Characters
- 【LeetCode】3. Longest Substring Without Repeating Characters
- [LeetCode]3. Longest Substring Without Repeating Characters
- Leetcode 3. Longest Substring Without Repeating Characters
- LeetCode3. Longest Substring Without Repeating Characters
- leetcode 3. Longest Substring Without Repeating Characters
- leetcode-3. Longest Substring Without Repeating Characters
- leetcode--3. Longest Substring Without Repeating Characters