Question on hackerblock

question: https://hack.codingblocks.com/app/practice/2/272/problem
ans: https://ide.codingblocks.com/s/269487

i am trying to debug please give some time

what should i change in the code;

this is how the value of each node is derived

how the tree is formed?steps?

@neelrai906


update has to be made in replaceNode
first take curr node value in temp
update node value with sum
and update sum

1 Like

thank you so much.appreciate it;

1 Like

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.