Company: Infoedge_23aug
Difficulty: medium
Divisible Tree Splits Problem Description Given an undirected tree with n nodes labeled 0 to n - 1 , represented by a 2D integer array of edges of length n - 1 , where edges[i] = [a_i, b_i] denotes the existence of an edge in the tree connecting nodes a_i and b_i . You are given an integer k and a 0-indexed integer array values of length n , where values[i] represent the value corresponding to the i th node in the tree. To obtain a valid split of the tree, you can remove any set of edges (which may or may not be empty) from the tree. After removing the edges, the resulting components should have values such that the sum of the values of each connected component is divisible by k . In other words, the goal is to partition the tree into connected components in such a way that the sum of values in each component is a multiple of k . The task is to find the maximum number of valid splits or configurations satisfying the given conditions. Input Format The First line of input contains an int