Maximum White Subtree
HardRating 1800CodeforcesAdvanced Trees (BST, LCA, Tree DP)
Approach hintTry it first, then revealHide
First compute the best downward value at each vertex, adding a child only when its value is positive. A second DFS reroots by passing down the parent's value with the current child's contribution removed.