import java.util.*;
public class Solution {
    public ArrayList<Integer> maxInWindows(int[] shu, int k)
	{
		ArrayList<Integer> ar = new ArrayList<Integer>();
		if (k == 0)
			return ar;

		int len = shu.length;
		int res[] = new int[len];

		int head = 0, tail = 0;
		for (int i = 0; i < len; i++)
		{
			if (head <= tail && i - k >= res[head])
				head++;
			while (head <= tail && shu[res[tail]] <= shu[i])
				tail--;
			res[++tail] = i;
			if (i - k + 1 >= 0)
				ar.add(shu[res[head]]);
		}

		return ar;

	}
}