```
TreeNode* createBST(vector<int> &num, int l, int h) {
if(l > h) return NULL;
int mid = (l+h)/2;
TreeNode *root = new TreeNode(num[mid]);
root->left = createBST(num, l, mid-1);
root->right = createBST(num, mid+1, h);
return root;
}
class Solution {
public:
TreeNode *sortedArrayToBST(vector<int> &num) {
return createBST(num, 0, num.size()-1);
}
};
```

Thoughts: same as previous question: find out the middle element as current TreeNode. Then solve the problem by recursive.