@@ -0,0 +1,1066 @@
+import java.util.Arrays;%0Aimport java.util.LinkedList;%0A%0Apublic class LeetCode0239 %7B%0A    public int%5B%5D maxSlidingWindow(int%5B%5D nums, int k)%0A    %7B%0A        if (k == 0 %7C%7C nums == null %7C%7C nums.length == 0) %7B%0A            return new int%5B0%5D;%0A        %7D%0A        int%5B%5D result = new int%5Bnums.length - k + 1%5D;%0A%0A        LinkedList%3CInteger%3E deque = new LinkedList%3CInteger%3E();%0A%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A%0A            if (!deque.isEmpty() && deque.peekFirst() == i - k) %7B%0A                deque.pollFirst();%0A            %7D%0A%0A            while (!deque.isEmpty() && nums%5Bdeque.peekLast()%5D %3C nums%5Bi%5D) %7B%0A                deque.removeLast();%0A            %7D%0A%0A            deque.offer(i);%0A%0A            if (i %3E= k - 1) %7B%0A                result%5Bi - k + 1%5D = nums%5Bdeque.peekFirst()%5D;%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        LeetCode0239 leetcode = new LeetCode0239();%0A        int%5B%5D nums = new int%5B%5D %7B 1, 3, 1, 2, 0, 5 %7D;%0A        System.out.println(Arrays.toString(leetcode.maxSlidingWindow(nums, 3)));%0A    %7D%0A%7D

Add LeetCode0239.java