We check for each element if it is greater than left and right.At any point of time if left=i then right=i+k+1.We maintain a sliding window of size k+2.We thus start with our sliding window for K Empty Slots.The above two steps help us to proceed with the sliding window and hence are important for us to proceed.We maintain a variable min to hold the answer.Days-1] will hold the position i.e i+1.Let us create an array named days to hold the position of the flower number that is blooming on that particular day.Without any further delay let us jump right into the solution of K Empty Slots We have a wide range of problems on this topic that you can check out before we proceed on to learn further. The approach I am about to describe uses the sliding window approach. Image illustrating the same An illustration showing the blooming pattern How to approach the problem? On the second day, the third and the fifth flower bloom leaving a flower that is still blooming. So, rather than exaggerating, I will be running through a sample for an input. The mystery behind K Empty Slots is thus unlocked, or is it? We will be finding the day on which two flowers are blooming with k non-blooming flowers between them.