Maximum Sum Path In a Binary Tree Implementation

I have tried to code this along the video but I am not getting right answer. Can you tell me where I am making mistake?My Code is : https://ide.codingblocks.com/s/219666

@gourav
The mistake is you are printing the value that is returned from the funtion, which is just a temporary answer that needs to returned to its parent.
But the actual answer can be different.
So just print “s.globalMaximum”, according to your code.

1 Like

@gourav Also mark this doubt as resolved if you have solved the problem now.