Unable to understand the logic

Unable to understand the logic after processing k elements

In this question we need to find out maximum element in every window of size k.
for example let say
array - 2 3 1 4 3
k = 2
then output should be
3 (beacause in 1st window from 0 to 1 maximum is 3)
3 (beacause in 2nd window from 1 to 2 maximum is 3)
4 (beacause in 3rd window from 2 to 3 maximum is 4)
4 (beacause in 4th window from 3 to 4 maximum is 4)

For the complete video, please refer this video:


It is well explained here.

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.