You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 132 |[Movie Rating](https://leetcode.com/problems/movie-rating/description/)|[Solution](solutions/132_movie_rating.md)| LeetCode | Medium ||
168
168
| 133 |[Restaurant Growth](https://leetcode.com/problems/restaurant-growth/description/)|[Solution](solutions/133_restaurant_growth.md)| LeetCode | Medium ||
169
+
| 134 |[Friend Requests II: Who Has the Most Friends](https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends/description/)|[Solution](solutions/134_friend_requests_ii_who_has_the_most_friends.md)| LeetCode | Medium |`UNION ALL`|
169
170
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
Write a solution to find the people who have the most friends and the most friends number.
11
+
12
+
The test cases are generated so that only one person has the most friends. [[Full Description](https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends/description/)]
13
+
14
+
## Submitted Solution
15
+
16
+
```sql
17
+
-- Submitted Solution
18
+
WITH cte1 AS (
19
+
SELECT
20
+
accepter_id AS id
21
+
,COALESCE(COUNT(DISTINCT requester_id), 0) AS total
22
+
FROM RequestAccepted
23
+
GROUP BY accepter_id
24
+
),
25
+
cte2 AS (
26
+
SELECT
27
+
requester_id AS id
28
+
,COALESCE(COUNT(DISTINCT accepter_id), 0) AS total
0 commit comments