Company: HPE_28sep
Difficulty: medium
No Ancestor Subset Problem Description You are given a tree with tree_nodes nodes, labelled 1 to tree_nodes (1-based indexing). Node i has an associated weight weight[i] . The tree is rooted at node 1 . A subset of nodes is called good if there is no pair of nodes in it where one node is an ancestor of the other. Find the maximum sum of weights of the nodes in a good subset. Note: A node u is an ancestor of node v if u lies on the direct path from the root to node v . A node is not its own ancestor, so any single node forms a good subset on its own. Complete the function findMaximumSum with the following parameters: int tree_nodes : the number of nodes int tree_from[tree_nodes - 1] : one set of endpoints of the edges int tree_to[tree_nodes - 1] : the other set of endpoints of the edges int weight[tree_nodes] : the weights of the nodes Returns: long : the maximum sum of weights of the nodes of a good subset. Input Format The first line contains two space-separated integers tree_nodes an