@@ -0,0 +1,2637 @@
+import java.util.HashMap;%0A%0A/**%0A * Minimum Window Substring%0A * Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).%0A * For example,%0A * S = %22ADOBECODEBANC%22%0A * T = %22ABC%22%0A * Minimum window is %22BANC%22.%0A * Tags: Hash Table Two Pointers String%0A * Similar Problems:  (H) Substring with Concatenation of All Words (M) Minimum Size Subarray Sum (H) Sliding Window Maximum%0A * %0A * Analysis:%0A * 1.Store the char in string t as a key and times appearing as value into a hashmap;%0A * 2.If char at s is contained in hashmap, value(times) in map - 1 and count ++;%0A * 3.When count = t.length(), minLenght and minStart records the min number%0A * 4.Slide window and let the left point to the first char in s ,which is in map  %0A *        s                        t        %0A * A D O B E C O D E B A N C      A B C%0A * A D O B E C %0A * B E C O D E B A%0A * C O D E B A%0A * B A N C%0A * %0A * @author chenshuna%0A */%0A%0Apublic class MinimumWindowSubstring %7B%0A    public static String minWindow(String s, String t) %7B%0A        if(s.length() == 0 %7C%7C t.length() ==0 %7C%7C s.length() %3C t.length()) %7B%0A            return %22%22;%0A        %7D%0A        HashMap%3CCharacter, Integer%3E map = new HashMap%3CCharacter, Integer%3E();%0A        for(char c : t.toCharArray()) %7B%0A            if(map.containsKey(c)) %7B%0A                map.put(c, map.get(c) + 1);%0A            %7D%0A            else%0A                map.put(c, 1);%0A        %7D%0A        int left = 0;%0A        int count = 0;%0A        int minStart = 0;%0A        int minLength = s.length() + 1;%0A        for(int right = 0; right %3C s.length(); right++) %7B%0A            if(map.containsKey(s.charAt(right))) %7B%0A                map.put(s.charAt(right), map.get(s.charAt(right)) - 1);%0A                if(map.get(s.charAt(right)) %3E= 0)%7B %0A                    count++;%0A                %7D%0A                while(count == t.length())%7B%0A                    if((right - left + 1) %3C minLength) %7B%0A                        minStart = left;%0A                        minLength = right - left + 1;%0A                    %7D%0A                    if(map.containsKey(s.charAt(left)))%7B%0A                        map.put(s.charAt(left), map.get(s.charAt(left)) + 1 );%0A                        if(map.get(s.charAt(left)) %3E 0) %7B%0A                            count--;%0A                        %7D%0A                    %7D%0A                    left ++;%0A                %7D%0A            %7D%0A        %7D%0A        if(minLength == s.length()+1) %7B%0A            return %22%22;%0A        %7D%0A        return s.substring(minStart, minStart + minLength);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.print(minWindow(%22ADOBECODEBANC%22, %22ABC%22));%0A    %7D%0A%7D

add 76