class Solution: def maxInWindows(self, num, size): # write code here res = [] length = len(num) if size>length or size<1: return [] for i in range(length-size+1): max_num = num[i] for j in range(size): max_num = max(max_num, num[i+j]) res.append(max_num) return res