@@ -0,0 +1,904 @@
+public class LongestSubstringWithoutRepeatingCharacters %7B%0A    public static int lengthOfLongestSubstring(String s) %7B%0A        // keep track of the index of the last occured character%0A        int%5B%5D lastIndexOf = new int%5B256%5D;%0A        for (int i = 0; i %3C 255; i++) lastIndexOf%5Bi%5D = -1;%0A        // keep track of the left bound of the current longest substring%0A        int left = 0;%0A        int maxLen = 0, curLen = 0;%0A%0A        for (int i = 0; i %3C s.length(); i++) %7B%0A            char c = s.charAt(i);%0A            if (lastIndexOf%5Bc%5D %3E= left) left = lastIndexOf%5Bc%5D + 1;%0A            curLen = i - left + 1;%0A            if (maxLen %3C curLen) maxLen = curLen;%0A            lastIndexOf%5Bc%5D = i;%0A        %7D%0A        return maxLen;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(lengthOfLongestSubstring(%22hello world%22));%0A        System.out.println(lengthOfLongestSubstring(%22aaaaa%22));%0A    %7D%0A%7D

Complete Longest Substring Without Repeating Characters