Why its o/p is 37 ratherthen 60

which testcase are you taking about??

don’t forgot to tagged question

basically i am finding total sum of nodes for my input given it shuld be 60 but o/p is showing 37???

please provide sample input for which you are checking

because your code is looking correct

1 4 0 6 5 6 7 8 0 0 0 0 0 0 0 3 20 0 0 0

code is correct
input is wrong

you have provide 7 zeroes b/w 8 and 3 but only 6 are required
correct input is:
1 4 0 6 5 6 7 8 0 0 0 0 0 0 3 20 0 0 0
now check
it is giving correct ans

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.