import java.util.*;
public class SubArrayProblem{
private LinkedList maxList;
private LinkedList minList;
private int[] arr;
private int value;
public SubArrayProblem(int[] _arr,int num){
maxList = new LinkedList();
minList = new LinkedList();
arr = _arr;
value = num;
}
//缩å°ï¼L++
public void shrinkWindow(int index){
while(!maxList.isEmpty()){
if(maxList.peekFirst() > index){
break;
}
maxList.removeFirst();
}
while(!minList.isEmpty()){
if(minList.peekFirst() > index){
break;
}
minList.removeFirst();
}
}
//æ©å¤§ï¼R++
public void magnifyWindow(int index){
if(maxList.isEmpty()){
maxList.offerLast(index);
}else{
while(!maxList.isEmpty()){
if(arr[maxList.peekLast()]>arr[index]){
break;
}
maxList.removeLast();
}
maxList.offerLast(index);
}
if(minList.isEmpty()){
minList.offerLast(index);
}else{
while(!minList.isEmpty()){
if(arr[minList.peekLast()]