You are given an undirected tree and can apply at most koperations on it. In one operation, remove a leaf vertex and its adjacent edge. A leaf vertex is a vertex that is connected to exactly one other vertex. Minimize the tree's diameter by applying the operation as many as k times.
Use the following assumptions:
1)he distance between two vertices is the number f edges in their shortest path.
2)he diameter of a tree is the maximum distance among all pairs of vertices in the tree.
Return the minimum possible diameter after applying at most 'k' operations.
Example :
n=5
k=2
edges = [[1, 2], [1, 4], [2, 3], [2, 5]]

One possible way to minimize the tree diameter is to delete nodes [3, 5] as shown below. The resulting diameter is 2 formed by the nodes [2, 1, 4].

Function Description
Complete the function treeCut in the editor below.
treeCut has the following parameter(s):
Constraints