Guest User

Untitled

a guest
Jun 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. class Solution {
  2. public:
  3. int sum =0;
  4. TreeNode* convertBST(TreeNode* root) {
  5. if(root == nullptr)
  6. return nullptr;
  7. convertBST(root->right);
  8. sum += root->val;
  9. root->val = sum ;
  10. convertBST(root->left);
  11. return root;
  12. }
  13. };
Add Comment
Please, Sign In to add comment