We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
THIS QUESTION IS SO F BAD. It's not like it's hard but the problem is so poorly explained and the test cases are so illy created.
I at first thought it's just all the left most nodes and right most nodes are visible from top view, it also satisifies the test case presented and fit the problem difficulty. But no, so I had to search up the definition of top view which turns out is horizontal distance corresponds to the node parent. Thats also bearable, just need to keep track of parent distance and visited distance, not too bad.
BUT HOW CAN YOU NOT ALLOW DIFFERENT PERMUTATION OF THE ANSWER?!
so i had to guess it's sorted by the distance and store them in hashmap... sigh
Tree : Top View
You are viewing a single comment's thread. Return to all comments →
THIS QUESTION IS SO F BAD. It's not like it's hard but the problem is so poorly explained and the test cases are so illy created.
I at first thought it's just all the left most nodes and right most nodes are visible from top view, it also satisifies the test case presented and fit the problem difficulty. But no, so I had to search up the definition of top view which turns out is horizontal distance corresponds to the node parent. Thats also bearable, just need to keep track of parent distance and visited distance, not too bad.
BUT HOW CAN YOU NOT ALLOW DIFFERENT PERMUTATION OF THE ANSWER?!
so i had to guess it's sorted by the distance and store them in hashmap... sigh