Please help its not accepting the all tc this is problrm of finding total sum of node of tree

hello @kailash_01
your logic for getting sum of all nodes is correct.
please share the question along with constraint so that i can check why ur coding is not working.

https://hack.codingblocks.com/app/practice/2/276/problem

change datatype of int to long long in ur sum function it will work.

image

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.