Daily bit(e) of C++ #28, Common C++ interview problem: Maximum in a sliding window
Perhaps you have a small misprint {2,5,5}, but i think it should be {2,-3,5}
You are not looking for a maximum window, you are calculating the maximum from each position of the sliding window.
So idea is find maksimum between nums in window on each step?
If we have e.g 0,-1,-2,1,1 and size 2 we will get 0,-1,1,1 ???? Is it correct suggestion?
Yup, that's it.
Oh, now i catch the idea. Sorry for incorrect comment. :)
Perhaps you have a small misprint {2,5,5}, but i think it should be {2,-3,5}
You are not looking for a maximum window, you are calculating the maximum from each position of the sliding window.
So idea is find maksimum between nums in window on each step?
If we have e.g 0,-1,-2,1,1 and size 2 we will get 0,-1,1,1 ???? Is it correct suggestion?
Yup, that's it.
Oh, now i catch the idea. Sorry for incorrect comment. :)