NumPy allowed · plain Python earns 10 bonus points
Maintain a monotonic decreasing deque of indices to achieve O(1) amortized maximum lookup for every position of a sliding window.
Implement max_sliding_window(nums, k): return a list of the maximum elements for each sliding window of size k moving from left to right across nums.
max_sliding_window(nums: list[int], k: int) -> list[int]