Regarding one test case

my code is not working for 1 test case

hello @singh.pankhil40 there was some error in your buildtree function .
i have changed your buildtree fucntion and now your code is giving correct anser for all the test cases.
code -https://ide.codingblocks.com/s/323295.
please try to understand the difference between your buildtree and this build tree function .
i have implemented your code only in the better way.
i hope i have resolved your doubt .
Happy Learning !

can you tell what went wrong in my build tree

@singh.pankhil40 try fir this test case you will understand where youo were going wrong
input :1 2 3 -1 4 -1 5 -1 -1 -1 6 -1 7 -1 8 -1 -1
expected outputis different from yours .
try to dry run for this test case.

thanks i understood when we pop 5 queue becomes empty which shouldn’t have happened