TREE RIGHT VIEW Given a binary tree , print its nodes from root to bottom as visible from right side of tree


test case no passing
Also let me know a more opitimized approach please

Hello @RUPESH,

  1. Your Code is failing for the test case like:
    1 6 2 8 7 4 3 11 -1 9 -1 5 -1 -1 -1 -1 -1 10 -1 -1 -1 -1 -1
    Visualising the Tree:
    _______________________________1
    _________________6 _________________________2
    ________8 ________________7 ________4 ________________3
    _____11 ________________9 ________5
    ____________________10
    Correct it.

  2. You can refer to this video for an optimised approach.
    Feel free to ask if you don’t understand anything.

Feel free to ask if you face any difficulty.
Hope, this would help.
Give a like if you are satisfied.

1 Like

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.