Company: Salesforce_24may
Difficulty: medium
Optimizing Salesforce Hierarchy Problem Description In a Salesforce data hierarchy which is present as tree-like structure, each node represents a data object and each edge represents a relationship between two data objects. You are given a tree by applying at most k operations. In one operation, remove a leaf data object and its relationship. A leaf data object is a node with exactly one relationship (edge). Minimize the tree's diameter by applying the operation as many as k times. Definitions: The distance between two data objects is the number of relationships (edges) in the shortest path connecting them. The diameter in the hierarchy tree is defined as the maximum distance among all pairs of data objects. Return the minimum possible diameter in the hierarchy tree after performing at most k optimizations. For example, given a tree with `n = 5` nodes, `k = 2` operations, and `edges = [[1, 2], [1, 4], [2, 3], [2, 5]]`: (Note: Image URLs are placeholders as I cannot generate them. Plea