101
0/304
Loading content...
A music intelligence platform tracks listening behavior and social links to identify friendship pairs with strongly aligned daily listening patterns.
Table: Listens
Table: Friendship
Task: Report friend pairs that meet all of the following:
Output requirements:
Supported submission environments:
Listens:
| user_id | song_id | day |
|---------|---------|------------|
| 1 | 10 | 2021-03-15 |
| 1 | 11 | 2021-03-15 |
| 1 | 12 | 2021-03-15 |
| 2 | 10 | 2021-03-15 |
| 2 | 11 | 2021-03-15 |
| 2 | 12 | 2021-03-15 |
| 4 | 10 | 2021-03-15 |
| 4 | 11 | 2021-03-15 |
| 4 | 13 | 2021-03-15 |
| 5 | 10 | 2021-03-16 |
| 5 | 11 | 2021-03-16 |
| 5 | 12 | 2021-03-16 |
Friendship:
| user1_id | user2_id |
|----------|----------|
| 1 | 2 |
| 2 | 4 |
| 2 | 5 |[
{"user1_id":1,"user2_id":2}
]Only users 1 and 2 are friends with at least three common distinct songs on the same day.
Listens:
| user_id | song_id | day |
|---------|---------|------------|
| 1 | 7 | 2024-04-01 |
| 1 | 7 | 2024-04-01 |
| 1 | 8 | 2024-04-01 |
| 2 | 7 | 2024-04-01 |
| 2 | 8 | 2024-04-01 |
| 2 | 9 | 2024-04-01 |
| 1 | 20 | 2024-04-02 |
| 1 | 21 | 2024-04-02 |
| 1 | 22 | 2024-04-02 |
| 3 | 20 | 2024-04-02 |
| 3 | 21 | 2024-04-02 |
| 3 | 22 | 2024-04-02 |
Friendship:
| user1_id | user2_id |
|----------|----------|
| 1 | 2 |
| 1 | 3 |[
{"user1_id":1,"user2_id":3}
]Pair (1,2) has only two shared distinct songs on 2024-04-01 despite duplicate rows. Pair (1,3) qualifies on 2024-04-02.
Listens:
| user_id | song_id | day |
|---------|---------|------------|
| 1 | 31 | 2024-06-10 |
| 1 | 32 | 2024-06-10 |
| 1 | 33 | 2024-06-10 |
| 2 | 31 | 2024-06-10 |
| 2 | 32 | 2024-06-10 |
| 2 | 33 | 2024-06-10 |
| 2 | 40 | 2024-06-11 |
| 2 | 41 | 2024-06-11 |
| 2 | 42 | 2024-06-11 |
| 4 | 40 | 2024-06-12 |
| 4 | 41 | 2024-06-12 |
| 4 | 42 | 2024-06-12 |
| 4 | 50 | 2024-06-13 |
| 4 | 51 | 2024-06-13 |
| 4 | 52 | 2024-06-13 |
| 5 | 50 | 2024-06-13 |
| 5 | 51 | 2024-06-13 |
| 5 | 52 | 2024-06-13 |
Friendship:
| user1_id | user2_id |
|----------|----------|
| 1 | 2 |
| 2 | 4 |
| 4 | 5 |[
{"user1_id":1,"user2_id":2},
{"user1_id":4,"user2_id":5}
](1,2) and (4,5) each qualify on at least one same day. Pair (2,4) shares songs across different days, so it does not qualify.
Constraints