Wrong test case for problem 1483: Kth Ancestor of a Tree Node

In test case 12/16:
The tree has 1000 nodes. One of the queries is the 849th parent of node 788 and the expected answer is 5. It could not be the answer because the 5th parent of node 788 is 0 (the root) and as you know, the root does not have a parent.
What happened:
The program that created the test case probably arrived at -1 as the 6th parent and then checked what is the parent of -1 and instead of returning -1 indicating there is no such node it checked what is the parent of the last node in the tree. Doing that again and again it arrived at 5.

Comments (0)