Two return statements

why the two return statements are required in this case
root gets NULLl then why root->left == NULL and root->right==NULL is written
are the different condition ?

Hello @atkr030 this depends on the implementation how you are implementing it.
i don’t know your way of solving this either you share your code then i can explain.
but you can do this with one return statement as well.
Here for your reference i am attaching the code with one return statement as the same as that of yours.


Happy Learning!!

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.