Max element in every window of size k

why we are taking the other loop for the first k elements

basically we are using the concept of sliding window. in this we first process the first k elements then window size increases by 1 unit in right and decrease by 1 unit in left. that’s why we have to treat first k elements differently.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.