minimum window substring, tail and head ptr, stat array for tofind and hasfound, find first valid window by moving end ptr from 0 to end, shrink the window by moving head pointer while window is valid