Given the root of a binary tree, a target node in the tree, and an integer k, return a list of the values of all nodes that are at a distance of k from the target node.
The answer may be returned in any order.
Constraints:
The number of nodes in the tree is in the range
Node.val
All the values Node.val are unique.
target is the value of one of the nodes in the tree.
k
Given the root of a binary tree, a target node in the tree, and an integer k, return a list of the values of all nodes that are at a distance of k from the target node.
The answer may be returned in any order.
Constraints:
The number of nodes in the tree is in the range
Node.val
All the values Node.val are unique.
target is the value of one of the nodes in the tree.
k