Problem Description
A = 1
/ \
2 3
/ \
4 5
B = 2
C = 1
Input 2:
A = 1
/ \
2 3
/ \
4 5
B = 2
C = 2
[1, 4, 5]
Output 2:
[3]
Explanation 1:
For the given tree, we have target node as 2.
All the nodes with are at distance 1, meaning the adjacent nodes are [1, 4, 5].
Explanation 2:
The given tree is same, and [3] is the only node with distance 2.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.