Help me out in this problem
yes…wait…
Bro sometimes it takes time to debug code ,have some patience.
Hey @shivammishra20121999
I am not able to debug ur code
Here added 2 cout statements in ur code for debugging
I am not able to understnad how its receiving 2 from l for that input (see input in that link)
If u are able to uunderstand that then let me know and I will try my best to help u out 
int l=longest(root->left);
int r=longest(root->right);
u made call to wrong function
If u dont have any other doubt in this then please hit a like and mark this as resolved :).
1 Like