Preorder built time limit error
The code is correct, just the input u are providing in not in the desired fashion
5 6 -1 -1 7 -1 -1
would build a tree of the form
5
/
6 7
on passing -1 u basically return back to the previous node
for building this tree the i/p has to be
3 4 5 -1 -1 1 -1 -1 6 -1 -1
Hope u are clarified in terms of how to sent the i/p
okay thanks 
Is there still a problem that u are facing?
Bro , aap input format galat le rahe ho !.
kuch issue hai kya cb portal me,yeh doubt mujhe visible ho raha hai my doubts me
3
/ \
4 5
\ /
6 1
for this input will be 3 4 -1 6 5 1 -1
but TLE is occuring 
iska input format will be
3 4 -1 6 -1 -1 5 1 -1 -1 -1
if the node does not have a left or right child provide -1 in that place so that it returns back.
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.
