You are viewing a single comment's thread. Return to all comments →
Top view of the above binary tree is
2 1 3 6
How about this sample?
It is not, that example would be 213. Only the topmost left and right nodes of a tree are in the topview.
I don't think you are right.
Please refer to http://www.geeksforgeeks.org/print-nodes-top-view-binary-tree/
You will understand the definition of the top view of a binary tree.That is an interesting question but not as simple as you think.
Yeah those links are cool and informative, but the problem is designed by a person and put on hackerrank. Look to the top comments :P
Agree. The fact that testcases does not include such case is just a flaw of testcases. You don't need to be such bad as well. Imagine inteview scenario: if you show solution with assumption not stated in problem that is a red flag.