```
class Solution(object):
def maxSlidingWindow(self, nums, k):
if(len(nums) == 0):
return []
if(k > len(nums)):
return []
if(k == 1):
return nums
l = []
max1 = max(nums[0:k])
l.append(max1)
i = k
while(i < len(nums)):
max1 = max(nums[i-k+1:i+1])
l.append(max1)
i += 1
return l
```