No New Friends
You are given n people represented as an integer from 0 to n - 1, and a list of friends tuples, where person friends[i][0] and person friends[i][1] are friends.
Return whether everyone has at least one friend.
Constraints
m ≤ 100,000wheremis the length offriends
https://binarysearch.com/problems/No-New-Friends
Examples
Example 1
Input
- n =
3 - friends =
[[0,1]]
Output
- answer =
False
Explanation
Person 2 is not friends with anyone.
Example 2
Input
- n =
3 - friends =
[[0,1],
[1,2]]
Output
- answer =
True
Explanation
- Person
0is friends with1 - Person
1is friends with0and2 - Person
2is friends with1.
Leave a comment