educative.io

https://www.educative.io/courses/grokking-coding-interview-patterns-python/RMkpmAllP9L

I don not understand the sample output from the examples. Can somebody provide some explanation to the problems?


Course: Grokking Coding Interview Patterns in Python - Learn Interactively
Lesson: Find Maximum in Sliding Window - Grokking Coding Interview Patterns in Python

Hi @Suresh_K_L, as the problem statement says that "we have given a specific window size from which we have to find the maximum number " when the size of the window is 3, and we traverse the array window by window, we have to find the maximum number from each window lets suppose we have an array a1=[1,-2,4,-1,6,9] and we have a window size of 3 so when we slide through the array at first iteration we will get the output 4 then on the second iteration we will get again 4 and then 6 and at last we will get 9 output. So our final output will be like output=[4,4,6,9].