You are given an undirected tree consisting of edges of length edges[i] cost of length cost[i] is the cost associated with node
You need to place coins on each node according to the following rules:
If the subtree rooted at node
Otherwise, select
Return an array ans of length ans[i] is the number of coins placed at node
Constraints:
edges.length
edges[i].length
cost.length
cost[i]
The input is generated such that edges represents a valid tree.
You are given an undirected tree consisting of edges of length edges[i] cost of length cost[i] is the cost associated with node
You need to place coins on each node according to the following rules:
If the subtree rooted at node
Otherwise, select
Return an array ans of length ans[i] is the number of coins placed at node
Constraints:
edges.length
edges[i].length
cost.length
cost[i]
The input is generated such that edges represents a valid tree.