You are given an undirected tree with edges of length edges[i]
You are also given an integer array nums of length nums[i] represents the value assigned to node k.
You can select a subset of nodes and perform an inversion operation on each selected node. When an inversion operation is performed on a node
A selection of nodes is valid if, for any two selected nodes
Return the maximum possible sum of all values in nums after applying any valid set of inversion operations.
Constraints:
edges.length
edges[i]
nums.length
nums[i]
The input is generated such that edges represents a valid tree.
You are given an undirected tree with edges of length edges[i]
You are also given an integer array nums of length nums[i] represents the value assigned to node k.
You can select a subset of nodes and perform an inversion operation on each selected node. When an inversion operation is performed on a node
A selection of nodes is valid if, for any two selected nodes
Return the maximum possible sum of all values in nums after applying any valid set of inversion operations.
Constraints:
edges.length
edges[i]
nums.length
nums[i]
The input is generated such that edges represents a valid tree.