I realised that my general approach to every problem is:
once we get right condition -> we update answer.
But we can actually think broadly and
we update answer along the way -> once we get invalid condition we adjust it (like moving the pointers to make current window valid) to make it valid
This is especially true for sliding windows cuz unlike normal questions like string or dfs or graph traversal, answer can be updated along the way.
Look at
https://velog.io/@whitehousechef/Leetcode-1004.-Max-Consecutive-Ones-III
and