Company: BNY_mellon
Difficulty: medium
Problem Description The country of Hackerland can be represented as a tree of tree_nodes nodes labeled from 1 to tree_nodes. The i-th edge is a bidirectional connection between the nodes numbered tree_from[i] and tree_to[i] and has a weight tree_weight[i]. Each node i is associated with an integer arr[i-1] (assuming 0-indexed array for 1-indexed nodes). The tree is rooted at node index 1. A tree is special if there is a pair of vertices indexes x and y such that: y lies in the subtree of x There is no instance of arr[z-1] < distance(x, z) where z is any node in the subtree of x (including x itself), and distance(x, z) is the sum of weights of the edges on the path between nodes x and z. In other words, for a tree to be special, there must exist at least one node x such that for all nodes z in the subtree of x, the condition arr[z-1] >= distance(x, z) holds. A leaf of the tree is a node connected to a single node by a single edge. In one operation, any one leaf is removed from the