单调队列
class Solution(object):
def maxInWindows(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
from collections import deque
big = deque([])
res = []
for i in range(len(nums)):
if big and i - k + 1 > big[0]: big.popleft()
while big and nums[big[-1]] <= nums[i]: big.pop()
big.append(i)
if i - k + 1 >= 0: res.append(nums[big[0]])
return res