t
.left
and right
, to 0, and a variable minLength
to infinity to store the length of the minimum window.required
to keep track of how many unique characters in t
are present in the current window.right
pointer and decrement the frequency of the character in the hashmap if it is found in t
.required
is 0, all characters are within the window, so try to shrink the window by moving the left
pointer.minLength
and record the current window.right
pointer reaches the end of s
.