Question: Given an array serverProp representing the properties of n servers. In a pool of servers, two servers located at indexes i and j are considered
Given an array serverProp representing the properties of n servers. In a pool of servers, two servers located at indexes i and j are considered connected if the greatest common divisor of their attributes, serverPropi and serverPropj is greater than These connected servers, whether connected directly or indirectly through others, form server clusters in the network.
Determine the size of the cluster to which each server belongs. Report an array of integers where the ith value represents the size of the cluster to which the ith server belongs.
Function Description: Complete the function getClusterSizes in the editor below.
getClusterSizes has the following parameters: serverPropn: the properties of servers that determine server connectivity
Returns: intn: the total size of the cluster to which each server belongs
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
