Solution
C++ []\nclass Solution {\npublic:\n    string minWindow(string s, string t) {\n        vector<int> map(128,0);\n        for (char c : t) {\n            map[c]++
```C++ []\nclass Solution {\npublic:\n    string minWindow(string s, string t) {\n        vector<int> map(128,0);\n        for (char c : t) {\n            map[c]++;\n        }\n\n        int counter = t.size(), begin = 0, end = 0, d = INT_MAX, head = 0;\n        while (end < s.size()){\n            if (map[s[end++]]-- > 0) {\n                counter--;\n            }\n            while (counter == 0) {\n                if (end - begin < d) {\n                    head = begin;\n                    d = end - head;\n                }\n                if (map[s[begin++]]++ == 0) {\n                    counter++;\n                }\n            }  \n        }\n        return d == INT_MAX ? "" : s.substr(head, d);\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def minWindow(self, s: str, t: str) -> str:\n        if len(s) < len(t):\n            return ""\n        needstr = collections.defaultdict(int)\n        for ch in t:\n            needstr[ch] += 1\n        needcnt = len(t)\n        res = (0, float(\'inf\'))\n        start = 0\n        for end, ch in enumerate(s):\n            if needstr[ch] > 0:\n                needcnt -= 1\n            needstr[ch] -= 1\n            if needcnt == 0:\n                while True:\n                    tmp = s[start]\n                    if needstr[tmp] == 0:\n                        break\n                    needstr[tmp] += 1\n                    start += 1\n                if end - start < res[1] - res[0]:\n                    res = (start, end)\n                needstr[s[start]] += 1\n                needcnt += 1\n                start += 1\n        return \'\' if res[1] > len(s) else s[res[0]:res[1]+1]\n```\n\n```Java []\nclass Solution {\n    public String minWindow(String s, String t) {\n        if (s == null || t == null || s.length() ==0 || t.length() == 0 ||\n                s.length() < t.length()) {\n            return new String();\n        }\n        int[] map = new int[128];\n        int count = t.length();\n        int start = 0, end = 0, minLen = Integer.MAX_VALUE,startIndex =0;\n        for (char c :t.toCharArray()) {\n            map[c]++;\n        }\n        char[] chS = s.toCharArray();\n        while (end < chS.length) {\n            if (map[chS[end++]]-- >0) {\n                count--;\n            }\n            while (count == 0) {\n                if (end - start < minLen) {\n                    startIndex = start;\n                    minLen = end - start;\n                }\n                if (map[chS[start++]]++ == 0) {\n                    count++;\n                }\n            }\n        }\n\n        return minLen == Integer.MAX_VALUE? new String():\n                new String(chS,startIndex,minLen);\n    }\n}\n```\n
['C++', 'Java', 'Python3']