Right View Binary Tree

How to take input for this!! I mean there is nothing given about how will be numbers in that array and all! or even if I can do by using while loop but there is nothing given about when to stop and all!! please about proper input methods! Thank you

Level order input is taken and tree is build by using the queue, in which firstly u will take a queue of nodes, and then it will have a data which will represent a root node, and then u will accept the left and right child of root node, -1 value means that the node does not have any child.

U can refer to this code for your help :slight_smile:

Hello, I know how to solve it! but in input format of given question there is nothing given about -1 and all!!

@sourav_817 input is level order input have send explanation and code for the same .
( I did not send the solution for view only the input)

You got me wrong! sorry for that! I just said that in Question there is nothing given about when to stop the loop but without it also we can do that question! ( I solved it later)! Anyways sorry sir!

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.