def max_sliding_window(nums, k):
if not nums:<EOL><INDENT>return nums<EOL><DEDENT>queue = collections.deque()<EOL>res = []<EOL>for num in nums:<EOL><INDENT>if len(queue) < k:<EOL><INDENT>queue.append(num)<EOL><DEDENT>else:<EOL><INDENT>res.append(max(queue))<EOL>queue.popleft()<EOL>queue.append(num)<EOL><DEDENT><DEDENT>res.append(max(queue))<EOL>return res<EOL>
:type nums: List[int]
:type k: int
:rtype: List[int]