剑指OFFER 滑动窗口的最大值
class Solution {
public:
vector<int> maxInWindows(const vector<int>& num, unsigned int size)
{
vector<int> res;
if(num.size()==0 || size == 0 || size>num.size())return res;
for(int i=0;i<=num.size()-size;i++)
{
int m = num[i];
for(int j=0;j<size;j++)
{
if(num[i+j]>m)
m=num[i+j];
}
res.push_back(m);
}
return res;
}
};