@@ -0,0 +1,982 @@
+package LeeCode.longestSubstringWithoutRepeatingCharacters;%0A%0A/*%0A * Given a string, find the length of the longest substring without repeating characters.%0A%0AExamples:%0A%0AGiven %22abcabcbb%22, the answer is %22abc%22, which the length is 3.%0A%0AGiven %22bbbbb%22, the answer is %22b%22, with the length of 1.%0A%0AGiven %22pwwkew%22, the answer is %22wke%22, with the length of 3. Note that the answer must be a substring, %22pwke%22 is a subsequence and not a substring.%0A */%0A%0A%0Aimport java.util.HashMap;%0A%0Aclass Solution %7B%0A    public int lengthOfLongestSubstring(String s) %7B%0A        if (s.length()==0) return 0;%0A        int max = 0;%0A        HashMap%3CCharacter, Integer%3E map = new HashMap%3CCharacter, Integer%3E();%0A        for(int i = 0, j = 0; i%3Cs.length(); i++)%7B%0A            if(map.containsKey(s.charAt(i)))%7B%0A                j = Math.max(j,map.get(s.charAt(i))+1);%0A            %7D%0A            map.put(s.charAt(i),i);%0A            if (max %3C i-j+1) %7B%0A                max = i-j+1;%0A            %7D%0A        %7D%0A        return max;%0A    %7D%0A%7D

add Longest Substring Without Repeating Characters