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 is not true:=> It is guaranteed that the tree is rooted at node.
The first hidden test case reveals that the data is supposed to have a 2 4 edge where 2 is not a child of the root node (1) at all, which means that it cannot be traversed starting from the root node. In other words there is no edge 1 2 relationship so the given 2 4 edge is illegitimate.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Visitor Pattern
You are viewing a single comment's thread. Return to all comments →
This is not true:=> It is guaranteed that the tree is rooted at node.
The first hidden test case reveals that the data is supposed to have a 2 4 edge where 2 is not a child of the root node (1) at all, which means that it cannot be traversed starting from the root node. In other words there is no edge 1 2 relationship so the given 2 4 edge is illegitimate.