We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f51c125 commit 1245451Copy full SHA for 1245451
README.md
@@ -606,4 +606,24 @@ FROM (
606
FROM Customer
607
) t
608
WHERE visited_on >= day_1+6;
609
-```
+```
610
+
611
612
+[602. Friend Requests II: Who Has the Most Friends](https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends)
613
614
+```sql
615
+-- `union` selects only unique vals, so we use `union all` here
616
617
+WITH CTE AS (
618
+ SELECT requester_id AS id FROM RequestAccepted
619
+ UNION ALL
620
+ SELECT accepter_id AS id FROM RequestAccepted
621
+)
622
623
+SELECT id, COUNT(id) AS num
624
+FROM CTE
625
+GROUP BY id
626
+ORDER BY num DESC
627
+LIMIT 1
628
629
0 commit comments