Company: UBS_7aug
Difficulty: medium
Merge Networks Problem Description Developers are working on a new mapping library to help road planning. They are working on a new approach to minimize distances between places. Currently, there are two networks of places, networkA and networkB , in the form of two trees. The number of nodes in each network are networkA_nodes and networkB_nodes respectively. There is an undirected edge from networkA_from[i] to networkA_to[i] (1 ≤ i ≤ networkA_nodes ) in networkA . Similarly, there is an undirected edge from networkB_from[i] to networkB_to[i] (1 ≤ i ≤ networkB_nodes ) in networkB . Their goal is to add one edge that connects a node in each network to minimize the maximum distance between any two nodes. Determine that distance. Given that one new road (or undirected edge) connecting one of the places in networkA and another in networkB is to be added in such a way that the maximum distance between any two different places in the final network is minimised, find the minimum p