C++ O(n) Recursive Solution | Easy to understand
\nTreeNode *BST(vector<int> &ans, int s, int e){\n    if (s > e) return NULL;\n    if (e == s){\n        TreeNode *root = new TreeNode(ans[e]);\n        return 
```\nTreeNode *BST(vector<int> &ans, int s, int e){\n    if (s > e) return NULL;\n    if (e == s){\n        TreeNode *root = new TreeNode(ans[e]);\n        return root;\n    }\n    else{\n        int i = s + (e - s) / 2;\n        TreeNode *root = new TreeNode(ans[i]);\n        root->left = BST(ans, s, i - 1);\n        root->right = BST(ans, i + 1, e);\n        return root;\n    }\n}\nTreeNode *sortedArrayToBST(vector<int> &nums){\n    TreeNode *newroot = BST(nums, 0, nums.size() - 1);\n    return newroot;\n}\n```
[]