Java 100% 2ms | Clean Code w/ Video Explanation
Please Upvote if you find the explanation helpful\n\nVideo Explanation\nMinimum Window Substring | YouTube\n\nJava Solution\n\n//2ms\n\nclass Solution {\n    pu
*Please **Upvote** if you find the explanation helpful*\n\n**Video Explanation**\n[Minimum Window Substring | YouTube](https://www.youtube.com/watch?v=vVSEJuN6BHA&feature=youtu.be)\n\n**Java Solution**\n```\n//2ms\n\nclass Solution {\n    public String minWindow(String s, String t) {\n        int [] map = new int[128];\n        for (char c : t.toCharArray()) {\n            map[c]++;\n        }\n        int start = 0, end = 0, minStart = 0, minLen = Integer.MAX_VALUE, counter = t.length();\n        while (end < s.length()) {\n              final char c1 = s.charAt(end);\n              if (map[c1] > 0) counter--;\n              map[c1]--;\n              end++;\n              while (counter == 0) {\n                    if (minLen > end - start) {\n                          minLen = end - start;\n                          minStart = start;\n                    }\n                    final char c2 = s.charAt(start);\n                    map[c2]++;\n                    if (map[c2] > 0) counter++;\n                    start++;\n              }\n        }\n\n        return minLen == Integer.MAX_VALUE ? "" : s.substring(minStart, minStart + minLen);\n    }\n}\n```
['Two Pointers', 'Sliding Window', 'Java']