Back to problems

Friends Of Appropriate Ages

Algorithm · Bloomberg · Medium

Requirements You are given an integer array ages[]. Compute the overall number of friend requests that are made. A person A may send a request to person B only when all of these statements are false: age[B] age[A] age[B] > 100 && age[A] < 100 Keep in mind that if every age lies in [1, 120], the third test already follows from the first two tests and can generally be omitted. When two distinct people are eligible to send requests in both directions, they contribute 2…

Checking your access…