Replace with a sum of greater nodes

i am getting wrong output . but i think approach is correct.can u plz check?

hi chehak
ur concept is not right
u r doing left +right but actually the left one is always smaller than the node for which u r calculating the greater sum
if u want to start with leftmost node then n^2 to be used
if u have to do in n then think of doing it from rightmost node

can u explain me the ques once

U have to replace the node with the greater one of it in the bst

please answer the doubt

Hi chehak
I have explained the question
Do u need code or something else clarification

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.