Company: Inmobi Oncampus_14june
Difficulty: medium
Diameter of a Tree Given an undirected tree and an integer k, implement a function that minimizes the tree's diameter by performing up to k operations. Each operation consists of removing a leaf vertex (a vertex connected to exactly one other vertex) and its adjacent edge. The function should determine the minimum possible diameter of the tree after performing up to k operations, where: The distance between two vertices is the number of edges in their shortest path. The diameter of a tree is the maximum distance among all pairs of vertices in the tree. Example: k = 2: One possible way to minimize the tree diameter is to delete nodes {3, 5}. The resulting diameter, in that case, is 2 formed by the nodes {2, 1, 4}. Function Description Complete the function findMinimumDiameter in the editor with the following parameters: int n : number of nodes int k : the maximum number of operations allowed int edges[n][2] : a 2D array connected node pairs Returns int : the minimum possible diameter of