记录一下自己暴力的挣扎史
import java.util.*;
public class Solution {
public ArrayList<Integer> maxInWindows(int [] num, int size) {
ArrayList<Integer> we = new ArrayList<>();
List<Integer> you = new ArrayList<>();
if(num.length < size || num.length == 0||size==0){
return we;
}
for(int i =0;i < num.length;i++){
for(int j =i;j<i+size;j++){
you.add(num[j]);
}
we.add(max(you));
you.clear();
if(i+size == num.length){
break;
}
}
return we;
}
public int max(List<Integer> we){
int max = we.get(0);
for(int i = 0;i<we.size();i++){
if(we.get(i)>max){
max=we.get(i);
}}
return max;
}
}