Java | Beats 100 %
java\nclass Solution {\n    public String minWindow(String s, String t) {\n        if(s.isEmpty()) return "";\n        int[] need = new int[128];\n        for(c
```java\nclass Solution {\n    public String minWindow(String s, String t) {\n        if(s.isEmpty()) return "";\n        int[] need = new int[128];\n        for(char c : t.toCharArray()) need[c]++;\n        char[] a = s.toCharArray();\n        int r = 0, l = 0, missing = t.length(), i = 0, j = 0;\n        while(r < s.length()){\n            if(need[a[r]] > 0) missing --;\n            need[a[r]]--;\n            r ++;\n            while(missing == 0){\n                if(j == 0 || (r - l) < (j - i)){\n                    j = r;\n                    i = l;\n                }\n                need[a[l]]++;\n                if(need[a[l]] > 0) missing++;\n                l++;\n            }\n        }\n        return s.substring(i, j);\n    }\n}\n```
[]