티스토리 뷰
https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends
Friend Requests II: Who Has the Most Friends - LeetCode
Can you solve this real interview question? Friend Requests II: Who Has the Most Friends - Table: RequestAccepted +----------------+---------+ | Column Name | Type | +----------------+---------+ | requester_id | int | | accepter_id | int | | accept_date |
leetcode.com
with base as (
select
requester_id as id
, count(distinct accepter_id) cnt
from RequestAccepted
group by 1
union all
select
accepter_id as id
, count(distinct requester_id) cnt
from RequestAccepted
group by 1
)
, total as (
select
id, sum(cnt) as num
from base
group by 1
)
select
distinct id, num
from total
order by num desc
limit 1'프로그래밍연습 > SQL' 카테고리의 다른 글
| [SQL]confirmation-rate (0) | 2023.08.22 |
|---|---|
| [SQL]exchange-seats (0) | 2023.08.21 |
| [SQL]game-play-analysis-iv (0) | 2023.08.19 |
| [SQL]human-traffic-of-stadium (0) | 2023.08.18 |
| [SQL]trips-and-users (0) | 2023.08.18 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 중앙값
- 파이썬
- Python
- 쿠싱
- 확률
- random forest
- 뇌하수체
- 코딩테스트
- neural network
- 분당서울대병원
- leatcode
- 조건부확률
- 상대도수
- 힙
- programmers
- Lambda
- 분산
- counter
- 통계
- 프로그래머스
- SQL
- 뇌하수체선종
- hash
- 평균
- 사분위수
- 쿠싱증후군
- TensorFlow
- 확률분포
- 상관관계
- 군고구마
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
글 보관함