#include <vector>
class Solution {
public:
    vector<int> ans;
    queue<int> q;
    vector<int> myMax;
    int idx;
    vector<int> maxInWindows(const vector<int>& num, unsigned int size) {
        if(num.size()<size||size==0) return ans;
        idx=0;
        for(int i=0;i<num.size();i++){
            q.push(num[i]);
            while(!myMax.empty()&&myMax.back()<num[i]){
                myMax.pop_back();
            }
            myMax.push_back(num[i]);
            if(i<size-1) continue;
            if(i>=size&&num[i-size]==myMax[idx]){
                idx++;
            }
            ans.push_back(myMax[idx]); 
        }
        return ans;
    }
};