```
class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer[]}
def maxSlidingWindow(self, nums, k):
__start = 0
__list = []
try:
max_ = max(nums[__start:__start+k])
index = nums.index(max_)
except ValueError:
return []
while __start + k <= len(nums):
max_ = nums[__start+k-1] if nums[__start+k-1] > max_ else max_
__list.append(max_)
if __start == index and __start +k < len(nums):
now = nums[__start+1:__start+1+k]
max_ = max(now)
index = __start+1+now.index(max_)
__start += 1
return __list
```

We can see that shouldn't compare each list slice,just only compare the next-into value if larger than last max value. Certainly we must think some especially cases.

Finally, your can find more funny thing about this web OJ on "http://tieba.baidu.com/p/3936529320",-------【python】大型刷题系列