Sliding Window Maximum
Problem statement
Given an integer array nums and a window size k, return the maximum value in every contiguous window of length k, from left to right.
Function
maxSlidingWindow(nums: int[], k: int) → int[]Examples
Example 1
nums = [1,3,-1,-3,5,3,6,7]k = 3return = [3,3,5,5,6,7]Example 2
nums = [1]k = 1return = [1]