You are given an integer array nums and an integer k. A sliding window of size k moves from left to right. Return the maximum value in the window at each step.
Input: Integer array nums and integer k (window size).
Output: Array of maximum values for each window position.
Input: [1,3,-1,-3,5,3,6,7],3
Output: [3,3,5,5,6,7]
Explanation: Windows: [1,3,-1]→3, [3,-1,-3]→3, [-1,-3,5]→5, [-3,5,3]→5, [5,3,6]→6, [3,6,7]→7.Input: [1],1
Output: [1]
Explanation: Single window.Input: [1,2,3,4,5],1
Output: [1,2,3,4,5]
Explanation: k=1: each element is its own window max.1<=nums.length<=10^5-10^4<=nums[i]<=10^41<=k<=nums.length