题解 | 滑动窗口的最大值
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param num int整型一维数组 # @param size int整型 # @return int整型一维数组 # class Solution: def maxInWindows(self,num: List[int], size: int) -> List[int]: # write code here if size==0: return [] result=[] n=len(num) left=0 for right in range(n): if right<size-1: continue x=max(num[left:right+1]) result.append(x) left+=1 return result