Given preorder array construct a BST
Your binary tree setup does not appear to be well balanced.... and no, the counter is unnecessary. I think you have perhaps over-thought the process...

If the data is pre-sorted, you can simply bifurcate your data in a recursive process.

Your method is very close to what I would do, so copy/paste:

private TreeNode dpPreOrderRecursive (int[] arr, /*Counter counter,*/ int min, int max) {

    int mid = (min + max) &gt;&gt; 1;
    TreeNode treeNode = new TreeNode(null, arr[mid], null);
    treeNode.left = mid &gt; min ? dpPreOrderRecursive(arr, min, mid - 1) : null;
    treeNode.right = mid + 1 &lt; max ? dpPreOrderRecursive(arr, mid + 1, max) : null;
}


Then, you can get your tree with:

TreeNode root = dpPreOrderRecursive(arr, 0, arr.length);


(none of the Integer.MIN/MAX).