# Convert Sorted Array to Binary Search Tree

class Solution {

public:

TreeNode\* sortedArrayToBST(vector\<int>& nums) {

return helper(nums,0,nums.size()-1);

}

TreeNode\* helper(vector\<int>& nums, int s, int e){

if(s>e)

return nullptr;

int mid=(s+e)/2;

TreeNode \*r= new TreeNode(nums\[mid]);

r->left=helper(nums,s,mid-1);

r->right=helper(nums,mid+1,e);

return r;

}

};
