https://ide.codingblocks.com/s/192705 whats wrong in my code???
Tree left view-1 test case wrong ans
your call on right subtree should be only when there is no left child, plus u need to take care of height, in your code the recurrence will print both left and right since the call and condition both are true for printing but for left view u need to use bfs technique
you do not need to go on the right child at all if the left child exists, since the left child is the only that needs to be checked for the left view
the test case gives the correct answer, it is probably due to time limit, try the bfs method
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.