https://ide.codingblocks.com/s/57853
it is printing the whole tree values not the left view
Tree left view 123
the code is running perfectly fine…try it on this example :
1 2 -1 -1 3 -1 5 -1 -1
but it is showing wrong answer while submitting
and for right view do right call first
To print left view, store one element for every level in an array that one element will be the first element stored in the level array if a element is stored for a level then don’t update else update it.
this link is not wrong
this link is not working