There's a kind of trick we call "growing window", where you grow a window as large as possible.
When you can't grow the window anymore, you restart the window.
You'll get practice with this in the next few problems.