You are given a positive integer, n, representing the number of nodes in a tree, numbered from edges of length edges[i]
You are also given a 2D integer array query of length query[i]
For each query i, find the node on the path between
Return an integer array where the value at index
Note: If there are multiple such nodes at the same minimum distance, return the one with the smallest index.
Constraints:
n
edges.length
edges[i].length
query.length
query[i].length
The graph is a tree.
You are given a positive integer, n, representing the number of nodes in a tree, numbered from edges of length edges[i]
You are also given a 2D integer array query of length query[i]
For each query i, find the node on the path between
Return an integer array where the value at index
Note: If there are multiple such nodes at the same minimum distance, return the one with the smallest index.
Constraints:
n
edges.length
edges[i].length
query.length
query[i].length
The graph is a tree.