Please tell how i take level order input for the tree

hello @anshulgurawalia

to construct a tree from level order , we perform level order traversal only .
look at this code.

this code is exaclty similar to level order traversal.
we pop node from q.
now we check whether its left node exist or not by checking value of c1 . it exist we create a new node and add it to the left of current node. and push that newly created node in q.

similarly we do for right node.
and at end when q get empty .
the tree construction is done and we return root of the tree

Not passing the test cases


this code is for tree right view