Given a tree with nodes nodes labeled from nodes parent of size nodes, where parent[i] represents the parent of node i, and an integer array value of size nodes, where value[i] denotes the value associated with node i.
If the sum of values of all nodes in a subtree is equal to
Return the total number of nodes remaining in the tree after deleting all subtrees with a sum of
Constraints:
nodes
parent.length nodes
parent[i] nodes
parent[0]
value.length nodes
value[i]
The given input is guaranteed to represent a valid tree.
Given a tree with nodes nodes labeled from nodes parent of size nodes, where parent[i] represents the parent of node i, and an integer array value of size nodes, where value[i] denotes the value associated with node i.
If the sum of values of all nodes in a subtree is equal to
Return the total number of nodes remaining in the tree after deleting all subtrees with a sum of
Constraints:
nodes
parent.length nodes
parent[i] nodes
parent[0]
value.length nodes
value[i]
The given input is guaranteed to represent a valid tree.