SubString Question Tip
Key for Substring Questions is to use to pointer start & end til the substr = str[start:end] meets the condition. So, you can use the template like below. String minWindow(String givenStr, String target) { //charCount is a map that holds counts of every character of target //it also means the numbers of each character that should be found in the substring Map<Character, Integer> charCount = new HashMap<Character, Integer>(); for (int i = 0; i < 128; i++) { charCount.put((char)i, 0) } for(char c : givenStr.toCharArray()) { charCount.put(c, charCount.get(c) + 1); } int start = 0; //pointer used for iteration int end = 0; //pointer used for iteration int counter = 0; //counter used to determine whether the window is valid, can vary(by the ...