Simple Standard C++ approach
Intuition\n Describe your first thoughts on how to solve this problem. \nThe intuition behind the approach is to construct a BST by recursively dividing the sor
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition behind the approach is to construct a BST by recursively dividing the sorted array into halves. The middle element of each subarray is chosen as the root of the corresponding subtree, ensuring that the left subtree contains smaller elements and the right subtree contains larger elements.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    TreeNode* sortedArrayToBST(vector<int>& nums) {\n           return build(nums,0,nums.size()-1);\n    }\n     TreeNode* build(vector<int>& nums,int left, int right) {\n            if(left>right)\n            return NULL;\n        int mid = (left+right)/2;\n        TreeNode* NewNode = new TreeNode(nums[mid]);\n        NewNode->left = build(nums,left,mid-1);\n        NewNode->right = build(nums,mid+1,right);\n        return NewNode;\n    }\n};\n```\n**Please Upvote if it helped**
['Recursion', 'C++']