You are given an undirected weighted tree with n nodes labeled from $0$ to n edges where edges[i] [u_i, v_i, w_i] represents an edge between nodes u_i and v_i with weight w_i.
You are also given an array queries where queries[j] [u_j, v_j].
For each query [u_j, v_j], consider the unique simple path starting from u_j and ending at v_j. Let the sum of all edge weights along this path be u_j to v_j such that the sum of edge weights from u_j to
Return an array of integers containing the answer for each query.
Constraints:
$2 \leq$ n
edges.length n
edges[i] [u_i, v_i, w_i]
$0 \leq$ u_i, v_i n
$1 \leq$ w_i
$1 \leq$ queries.length
queries[j] [u_j, v_j]
$0 \leq$ u_j, v_j n
The input is generated such that edges represents a valid tree.
You are given an undirected weighted tree with n nodes labeled from $0$ to n edges where edges[i] [u_i, v_i, w_i] represents an edge between nodes u_i and v_i with weight w_i.
You are also given an array queries where queries[j] [u_j, v_j].
For each query [u_j, v_j], consider the unique simple path starting from u_j and ending at v_j. Let the sum of all edge weights along this path be u_j to v_j such that the sum of edge weights from u_j to
Return an array of integers containing the answer for each query.
Constraints:
$2 \leq$ n
edges.length n
edges[i] [u_i, v_i, w_i]
$0 \leq$ u_i, v_i n
$1 \leq$ w_i
$1 \leq$ queries.length
queries[j] [u_j, v_j]
$0 \leq$ u_j, v_j n
The input is generated such that edges represents a valid tree.