The window is exactly k wide and stays exactly k wide — there is no
shrink decision to make here, so the only design question is what statistic rides along with the
frame. Here it is a single integer: how many vowels are inside. Each slide is two O(1) edits,
count += isVowel(s[i]) for the character entering on the
right and count -= isVowel(s[i-k]) for the one falling
off the left, which makes the whole scan O(n). Recounting each window from
scratch would be O(n·k) for the same answer. And since a window of width k has
only k slots, the moment the count reaches k you are done — nothing
later can beat it.
best == k is a hard ceiling: exit early.