```
class Solution {
public:
TreeNode* convertBST(TreeNode* root) {
Inorder(root);
return root;
}
int Inorder(TreeNode* root,int sum=0)
{
if(!root) return sum;
else
{
sum=Inorder(root->right,sum);
return sum=Inorder(root->left,root->val+=sum);
}
}
};
```