There is an undirected tree with edges of length edges[i] = values of length values[i] represents the value associated with the ith node.
You start with a score of i, add values[i] to your score, and set values[i] to
The tree is considered healthy if the sum of node values along every path from the root node to any leaf node is strictly greater than
Return the maximum score you can achieve while keeping the tree healthy.
Constraints:
edges.length
edges[i].length
values.length
values[i]
The input is generated such that edges represents a valid tree.
There is an undirected tree with edges of length edges[i] = values of length values[i] represents the value associated with the ith node.
You start with a score of i, add values[i] to your score, and set values[i] to
The tree is considered healthy if the sum of node values along every path from the root node to any leaf node is strictly greater than
Return the maximum score you can achieve while keeping the tree healthy.
Constraints:
edges.length
edges[i].length
values.length
values[i]
The input is generated such that edges represents a valid tree.