Java 4ms bit 97.6%
Basically, there are two pointers for windows sliding. One for exploiting new matched substring, other pointer for expiring previous substring.\n\n    public St
Basically, there are two pointers for windows sliding. One for exploiting new matched substring, other pointer for expiring previous substring.\n\n    public String minWindow(String s, String t) {\n            char[] s_array = s.toCharArray();\n            char[] t_array = t.toCharArray();\n            int[] map = new int[256];\n            int end = 0;\n            int start = 0;\n            int min_length = Integer.MAX_VALUE;\n            for(int i = 0; i < t_array.length; i++)\n                map[t_array[i]] ++;\n            int count = t_array.length;\n            int min_start = 0;\n            while(end < s_array.length)\n            {\n                if(map[s_array[end]] > 0)\n                {\n                    count--;\n                }\n                map[s_array[end]] --;\n                while(count == 0)\n                {\n                    if((end - start + 1) < min_length)\n                    {\n                        min_length = end - start + 1;\n                        min_start = start;\n                    }\n                    map[s_array[start]] ++;\n                    if(map[s_array[start]] > 0){\n                        count ++;\n                    }\n                    start++;\n                }\n                end ++;\n    \n            }\n            if( min_start+min_length > s_array.length)\n                return "";\n            return s.substring(min_start, min_start+min_length);\n        }
[]