101
0/304
Loading content...
You are given two event tables for a social networking system:
Both tables may contain duplicate rows.
Definitions:
Compute one metric: accept_rate = unique_acceptance_count / unique_request_count
Rules:
Return exactly one row with one column:
Supported submission environments:
friend_request:
| sender_id | send_to_id | request_date |
|-----------|------------|--------------|
| 1 | 2 | 2024-01-01 |
| 1 | 3 | 2024-01-01 |
| 1 | 4 | 2024-01-01 |
| 2 | 3 | 2024-01-02 |
| 3 | 4 | 2024-01-09 |
request_accepted:
| requester_id | accepter_id | accept_date |
|--------------|-------------|-------------|
| 1 | 2 | 2024-01-03 |
| 1 | 3 | 2024-01-08 |
| 2 | 3 | 2024-01-08 |
| 3 | 4 | 2024-01-09 |
| 3 | 4 | 2024-01-10 |[
{"accept_rate":0.8}
]There are 5 unique request pairs and 4 unique acceptance pairs, so the rounded acceptance rate is 0.80.
friend_request:
[]
request_accepted:
| requester_id | accepter_id | accept_date |
|--------------|-------------|-------------|
| 9 | 10 | 2024-04-11 |
| 9 | 10 | 2024-04-12 |[
{"accept_rate":0.0}
]When no requests exist, denominator is zero and the answer must be 0.00.
friend_request:
| sender_id | send_to_id | request_date |
|-----------|------------|--------------|
| 11 | 12 | 2024-02-01 |
| 12 | 13 | 2024-02-02 |
| 13 | 14 | 2024-02-03 |
| 14 | 15 | 2024-02-04 |
request_accepted:
| requester_id | accepter_id | accept_date |
|--------------|-------------|-------------|
| 11 | 12 | 2024-02-05 |
| 12 | 13 | 2024-02-05 |
| 13 | 14 | 2024-02-05 |
| 40 | 41 | 2024-02-06 |
| 41 | 42 | 2024-02-06 |
| 50 | 51 | 2024-02-07 |[
{"accept_rate":1.5}
]Accepted pairs can include pairs that never appeared in request events, so the ratio can exceed 1.00.
Constraints