Back to problems

Friend Request

Algorithm · Meta · Medium

Problem A website contains many users, and users may send friend requests to one another. For a user A to send a request to user B, the ages must satisfy the following rules: User B is older than half of User A's age plus 7. User B is no older than User A. User B's age lies between half of User A's age and twice User A's age, and both users are older than 100. Given a list of user ages, calculate the total number of friend requests sent during the specified period. Each…

Checking your access…