Given a tree of $n$ nodes. Each node has some weight associated with it. Find the minimum number of edges to be removed from the tree such that for all the newly formed trees (When we remove an edge, a new tree will be formed.), sum of all the weights of the nodes in each tree must be at most $K$ (Total weight $\le K$)?
Attempt:$\;$(pasted from the OP's comment)
Approach, I've tried is, I did post order traversal and found the weight of all subtrees. if subtree weight exceeds $K$, then I'll separate that subtree by removing an edge. Again, I need remove few edges in that tree to make sure the subtrees weigh less than $K$. I did this by sorting all child nodes in descending order according to weight of each child subtree and removing few subtrees as long as the tree weighs more than $K$.