You are given an array of integers nums and an integer k. There is a sliding window of size k which moves from the very left of the array to the very right.
Return the maximum value in each sliding window.
nums)kInput: [1,3,-1,-3,5,3,6,7] 3 Output: [3,3,5,5,6,7]
Print the result as a JSON array so it can be compared with expected output.
No submissions yet.
Discuss deque-based optimization, brute-force approach, and time complexity improvements.