Company: Oracle_11nov
Difficulty: medium
Selling Price Problem Description You have a rooted tree representing tree_nodes versions of a digital product, numbered from 1 to tree_nodes , with version 1 as the root. Each version has an assigned values[i] representing its download count. For each version, you need to determine its price, defined as: If the version has no child versions (a leaf node): its price is 0. Otherwise: its price is the maximum product of values assigned to two distinct versions in its subtree (including itself). Return an array where the i th element represents the price of version i . Function Description Complete the function findPrice in the editor with the following parameters: int tree_nodes : the total number of versions (nodes) in the tree int tree_from[i] : nodes on one end of connection int tree_to[i] : the other end node of connection vector<int> values : the downloads count of each version Returns long int[tree_nodes] : the price of every version's subtree Constraints 2 -10^5 The height o