Can you provide me some Hint. I am thinking that if we look from top then we can see all the leftmost and rightmost nodes of the tree but it is showing error.
Top View Tree Problem
No you have to do something different
consider these examples
1
/ \
2 3
/ \ / \
4 5 6 7
Top view of the above binary tree is
4 2 1 3 7
1
/ \
2 3
\
4
\
5
\
6
Top view of the above binary tree is
2 1 3 6
Code
Can you please provide me some HINT how can I approach or how do I think of it?
join this meet i will explain you
Can you please assign meeting at some definite time like at 9PM or 10PM
Ok 9PM is final
Join same meet at 9pm
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.