will u please check my logic for the create tree frompre and in as well as am not able to gave ouput in the format giving in the question where to insert a new line
Https://ide.codingblocks.com/s/265394
there are many small mistakes
- take n again before taking inorder
- while calling recursive function you flip in and pre order arrays
- add one condition if s==e return root;
you can see the modified code it is passing all testcase
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.