Prove safety OFFER ---- 59-1, the maximum value of the sliding window (js implemented)

Title
Given an array and the size of the sliding window, sliding window to find the maximum value among all values.

For example, if the input array size and {2,3,4,2,6,2,5,1} 3 sliding window, then the presence of a total of six sliding window, their maximum values ​​is {4,4,6, 6,6,5};

{2,3,4,2,6,2,5,1} for arrays sliding window has the following six:
{[2,3,4], 2,6,2,5,1},
{2, [3,4,2], 6,2,5,1},
{2,3, [4,2,6], 2, 5},
{2,3,4, [2,6,2 ], 5,1},
{2,3,4,2, [6,2,5], 1},
{2,3,4,2,6, [2, 5]}.


Thinking


Guess you like

Origin blog.csdn.net/qq_40816360/article/details/95239704