You are viewing a single comment's thread. Return to all comments →
The problem description is tricky and easily misleading. Specifically it says:
...Each of the subsequent lines contains two space-separated integers, *ui* and *vi* , describing an edge between nodes *u* and *v*.
*ui*
*vi*
*u*
*v*
An edge input like this:
3 4
does not mean that 3 is the parent. The parent may as well be noted on the right side. The correct interpretation:
3
There is just a link between 3 and 4, it's unspecified which one is tree node/leaf node.
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Java Visitor Pattern
You are viewing a single comment's thread. Return to all comments →
The problem description is tricky and easily misleading. Specifically it says:
...Each of the subsequent lines contains two space-separated integers,
*ui*
and*vi*
, describing an edge between nodes*u*
and*v*
.An edge input like this:
3 4
does not mean that
3
is the parent. The parent may as well be noted on the right side. The correct interpretation:There is just a link between 3 and 4, it's unspecified which one is tree node/leaf node.