Why my code is giving error

hello @kundankumarsports2
please check ur previous ,
i have already explained u the reason.
u need to change the logic of ur build tree function

Ya I checked please check this one and if any mistake is there in this correct it

in place of this function->
image

use this ->
image

because we r given level order (and not preorder)

The code what you gave me is of bfs please check it

yeah it is bfs code. and that is how we construct tree from given level order traversal (if still it is not clear then pls check input format of thr problem)

Can you modify the code and share the link

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.