Structurally identical


two test case failing

@ayush1213 your code will fail the cases where either of the tree is completely empty since you’re passing a “true” in the build function, your code cannot make an empty tree, and those cases will fail the test.
Instead of passing a true, just call the function and take the input inside the function, this will let you create empty trees as well.
Hope this helps.

@sgrarora3 sir i get it what you said but for root we are not taking any string so how to do it can u explain

From main, just call the add function and take the string input in the preorder function.
Take the example from the below code.

1 Like

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.