Maximum in Sliding Window

why do I have to do the first window independently at first and then the rest windows?

Lesson: Solution: Find Maximum in Sliding Window - Grokking Coding Interview Patterns in C++

When we move the sliding one position forward, we have to update window by popping the element that is no longer in it. This keeps on repeating whenever we update our sliding window. However, this condition does not apply to the very first sliding window since when window is initially empty, it has no elements to pop. Therefore, we will need a separate loop to populate window with the first w elements.
Happy Learning :slightly_smiling_face: