@@ -0,0 +1,1104 @@
+package com.lc.slidingwindow;%0A%0Aimport java.util.*;%0A%0Apublic class SlidingWindowMaximum %7B%0A%0A    public static int%5B%5D maxSlidingWindow(int%5B%5D nums, int k) %7B%0A        List%3CInteger%3E rst = new ArrayList();%0A        Deque%3CInteger%3E dq = new ArrayDeque%3C%3E();%0A%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            while(!dq.isEmpty() && nums%5Bi%5D %3E= nums%5Bdq.peekLast()%5D) %7B%0A                dq.pollLast();%0A            %7D%0A            // push the index from right of the queue%0A            dq.addLast(i);%0A            // think about when we would have to pop out from the frontal window%0A            if (dq.peekFirst() == (i - k)) %7B%0A                dq.pollFirst();%0A            %7D%0A            // k-1 is the position we start to have the maximum number in the window%0A            if (i %3E= k - 1) %7B%0A                rst.add(nums%5Bdq.peekFirst()%5D);%0A            %7D%0A        %7D%0A        return rst.stream().mapToInt(i-%3Ei).toArray();%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        int%5B%5D test = SlidingWindowMaximum.maxSlidingWindow(new int%5B%5D%7B1,3,-1,-3,5,3,6,7%7D, 3);%0A        System.out.println(Arrays.toString(test));%0A    %7D%0A%7D%0A

Create SlidingWindowMaximum.java