In replaceSum I didn’t get how the output is correct we are using the int return type and take root as a reference pass by value, then how is going to make the change in the actual root and also when i am dry this code on
e.g :
4, root
7, 9 leaf
output :
16
7,8
7+9 = 16 , so root->data = 16 , is updated but why temp+root+data