@@ -0,0 +1,1324 @@
+package algorithm.string;%0A%0A/**%0A * 3. Longest Substring Without Repeating Characters%0A * %3Cp%3E%0A * Given a string, find the length of the longest substring without repeating characters.%0A * Examples:%0A * Given %22abcabcbb%22, the answer is %22abc%22, which the length is 3.%0A * Given %22bbbbb%22, the answer is %22b%22, with the length of 1.%0A * Given %22pwwkew%22, the answer is %22wke%22, with the length of 3. Note that the answer must%0A * be a substring, %22pwke%22 is a subsequence and not a substring.%0A * %3Cp%3E%0A * https://leetcode.com/problems/longest-substring-without-repeating-characters/%0A *%0A * @author Allen on 2016/10/1.%0A */%0Apublic class LongestSubstringWithoutRepeatingCharacters %7B%0A%0A    public int lengthOfLongestSubstring(String s) %7B%0A        if (s == null %7C%7C s.isEmpty()) %7B%0A            return 0;%0A        %7D%0A        if (s.length() == 1) %7B%0A            return 1;%0A        %7D%0A%0A        int index = 0;%0A        int maxLen = 0;%0A        String str = s.substring(index, 1);%0A        for (int i = 0; i %3C s.length(); i++) %7B%0A            int indexOf = str.indexOf(s.charAt(i));%0A            if (indexOf != -1) %7B%0A                index = s.lastIndexOf(s.charAt(i), i - 1) + 1;%0A            %7D%0A            str = s.substring(index, i + 1);%0A            if (maxLen %3C str.length()) %7B%0A                maxLen = str.length();%0A            %7D%0A        %7D%0A        return maxLen;%0A    %7D%0A%0A%7D%0A

add longest-substring-without-repeating-characters solution