6-lines Java Accepted Solution
\nThe idea is making the middle element as root and recursively calling the method until the length of the array is zero.\n\n    \n    public class Solution {\n
\nThe idea is making the middle element as root and recursively calling the method until the length of the array is zero.\n\n    \n    public class Solution {\n            public TreeNode sortedArrayToBST(int[] nums) {\n                if(nums.length==0)return null;\n                int ptr=nums.length/2;\n                TreeNode root=new TreeNode(nums[ptr]);\n                root.left=sortedArrayToBST(Arrays.copyOfRange(nums,0,ptr));\n                root.right=sortedArrayToBST(Arrays.copyOfRange(nums,ptr+1,nums.length));\n                return root;\n            }\n        }
['Java']