其实就是将数组分割成,每个小数组的大小为小于等于1,直至不能再分。

        public int buildMinimalBST(int[] vals) {
            if(vals.length == 0) return 0;
            if(vals.length == 1) return 1;
            int mid = vals.length/2;
            int[] left = Arrays.copyOfRange(vals,0,mid);
            int[] right = Arrays.copyOfRange(vals,mid+1,vals.length);
            return (Math.max(buildMinimalBST(left)+1,buildMinimalBST(right)+1));

        }