public int removeFromEndDynamic(int input[]){
        int T[][] = new int[input.length][input.length];
        for(int l=1; l <= input.length; l++){
            for(int i=0, j = i + l-1; i < input.length-l+1; i++,j++){
                int min = min(input,i,j);
                int max = max(input,i,j);
                if(2*min > max){
                    T[i][j] = 0;
                }else{
                    T[i][j] = Math.min(T[i+1][j] , T[i][j-1]) +1;
                }
            }
        }
        return T[0][input.length-1];
    }
http://www.geeksforgeeks.org/remove-minimum-elements-either-side-2min-max/
src/com/interview/dynamic/RemoveFromEndToMake2IntoMinGreaterThanMax.java