All Posts
Leetcode 825: Friends Of Appropriate Ages
You are given an integer array ages
, where each element represents the age of a person on a social media platform. A person will not send a friend request to another person if any of the following conditions are true:
- The recipient’s age is less than or equal to half of the sender’s age plus 7.
- The recipient’s age is greater than the sender’s age.
- The recipient’s age is greater than 100 and the sender’s age is less than 100.
Otherwise, the sender can send a friend request. Return the total number of friend requests made between people.