I got RE NZEC in KPATHQRY. Solution 48673326
I am unable to find the what could lead the code to RE.
My approach was to find the deepest node from the list of given nodes in the query then traverse from there towards root. During this traversal I have deleted the nodes that are given in the list and store the nodes which have been travelled.
I again found the deepest node from the remaining nodes that are to be travelled and started traversing from their towards root. If I encounter an already travelled node the answer will be NO. If the list of nodes to be travelled have size=0 then the answer would be YES.