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.
The problem has a problem:
How can the two lines "5 1" and "1 2" both mean 1 is the root? Either we infer that 1 is always the root, or that smaller is always the root, but left --> right clearly doesn't work. The paths clearly have a direction, because if the paths were bidirectional, then any add query would add to all nodes.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subtrees And Paths
You are viewing a single comment's thread. Return to all comments →
The problem has a problem: How can the two lines "5 1" and "1 2" both mean 1 is the root? Either we infer that 1 is always the root, or that smaller is always the root, but left --> right clearly doesn't work. The paths clearly have a direction, because if the paths were bidirectional, then any add query would add to all nodes.