Replace with Sum of greater nodes

codeLink: https://ide.codingblocks.com/s/183224
why not my code is producing wrong output isn’t it the way the question has asked, correct my code and specify my mistake please

@Divya_321
Hello Divya,
BST follows one property i.e if u are at root then all node to right of it are bigger and all node to left of it are smaller.
so in this question root->data should only be replaced by root->data+sum(root->right)
but u are adding sum(root->left) as well because of which u r getting wrong answer

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.