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.
Agree the problem explanation is bad, had to google it. Basically we can think of it as root is at 0 on the x axis then the left child is at -1 and right child is at 1. If a node is at the same place on the x axis and there is another node higher up the tree/ closer to the root, it is blocked.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree : Top View
You are viewing a single comment's thread. Return to all comments →
Agree the problem explanation is bad, had to google it. Basically we can think of it as root is at 0 on the x axis then the left child is at -1 and right child is at 1. If a node is at the same place on the x axis and there is another node higher up the tree/ closer to the root, it is blocked.