public class Solution { public boolean VerifySquenceOfBST(int [] sequence) { int len = sequence.length; if(len == 0){ return false; } return help(sequence,0,len-1);

}
public boolean help (int[] sequence,int start,int end){
    if(start >= end){
        return true;
    }
    int root = sequence[end];
    int index = -1;
    for(int i = 0; i < end;i++){
        if(sequence[i] < root){
            index++;
        }
    }
    for(int i = index+1;i < end;i ++){
        if(sequence[i] < root){
            return false;
        }
    }
    return help(sequence,start,index) && help(sequence,index+1,end -1);
}

}