X is a niece of Y if there are W and Z such that X is a daughter of W, and W and Y are distinct children of Z
But the testing data seems to ignore the word "distinct" here (if I comment out my one-line check for that I pass, otherwise not). An example testcase:
- Code: Select all
tim is john's son.
john is david's son.
bill is david's son.
is tim john's son?
is tim john's nephew?
is tim bill's nephew?
The right answer should be:
- Code: Select all
yes
no
yes
But my code that produces this is rejected, while an incorrect code that returns "yes" to the 2nd query is accepted.
Note that the problem statement does allow 'A' to be 'B's nephew and son simultaneously (if B married a sibling!); my program handles this case correctly.

