Skip to content

Commit 1245451

Browse files
committed
Update README.md
1 parent f51c125 commit 1245451

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -606,4 +606,24 @@ FROM (
606606
FROM Customer
607607
) t
608608
WHERE visited_on >= day_1+6;
609-
```
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

Comments
 (0)