Question: Homecoming Party Problem Description The original family in the town has organised a homecoming party with N people invited. Each person has a special


Homecoming Party Problem Description The original family in the town has organised a homecoming party with N people invited. Each person has a special trust value denoted by array A. A person i will be friends with a person j only if either A[i]%A[j]==0 or A[j]%A[i]==0. Find the maximum number of friends each person can make in this party. Problem Constraints 1 Example Input Input1: A=[2,3,4,5,6] Input2: A=[6,6,6,6,6] Example Output Output1: [2,1,1,0,2] Output2: [4,4,4,4,4] Example Explanation Explaination1: 1st person has: 3rd and 5th as a friend 2nd person has: 5th as a friend 3rd person has: 1st as a friend 4th person has: 0 friends 5th person has: 1st and 2nd as a friend
Step by Step Solution
3.43 Rating (150 Votes )
There are 3 Steps involved in it
C ... View full answer
Get step-by-step solutions from verified subject matter experts
