Possible test cases error in "Cousins in Binary Tree" [LeetCode May Challenge - Day 7]

image

Input: root = [1,2,3,4], x = 3, y = 3
Output: false

The output should be false here right?
Depth and parent of both x and y are same. As the parent should be different according to the question right?
But its showing true in expected answer.

Let me know if I'm wrong? Can there be no identical nodes in a tree?

PS: I got accepted. As there was no test case for this.

Comments (1)