Company: Zscalar_9nov
Difficulty: medium
Maximum Common Companies Problem Description There is a network of friends numbered from 1 to friends_nodes who purchase wholesale products from different companies numbered from 1 to 100. Each pair of friends ( x[i] , y[i] ) is connected by a common company c[i] they both use. If friends x[i] and y[i] are connected by company c[i] , and friends y[i] and z[i] are also connected by the same company c[i] , then x[i] and z[i] are also considered connected by company c[i] . Your task is to find the maximum product of two friend IDs ( x[i] × y[i] ) within the largest group of friends connected by a common company. Complete the function countCompanies in the editor with the following parameter(s): int friends_nodes : the number of friends int friends_from[n] : each element i denotes the first friend in the pair i int friends_to[n] : each element i denotes the second friend in the pair i int friends_weight[n] : each element i denotes a company used by both friends in pair i Returns: int : the