public TreeNode sortedArrayToBSTRec(int[] num, int s, int e){
        if(s > e) return null;
        if(s == e) {
            return new TreeNode(num[s]);
        }
        int mid = (s+e) >> 1;
        TreeNode t1 = sortedArrayToBSTRec(num, s, mid - 1);
        TreeNode t2 = sortedArrayToBSTRec(num, mid + 1, e);
        TreeNode t = new TreeNode(num[mid]);
        t.left = t1;
        t.right = t2;
        return t;
    }