Wait, H
isn't in the substring! So let's skip to an element that's actually in the substring-- looks like A
:
1// we're looking at map['A'], it's currently 1 so proceed into the block
2 if (hash[s[end]] > 0) {
3 counter -= 1;
4 }
5
6 // modify the dictionary to say we've gotten this character requirement
7 // hash['A'] = 0
8 hash[s[end]] -= 1;
9
10 // check against our conditions
11
12 end += 1
13 # end is now 1, this will force us to step into checking the next letter
14}