You are viewing a single comment's thread. Return to all comments →
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.