Interview Query

Total Conversation Threads

Start Timer

0:00:00

Upvote
16
Downvote
Save question
Mark as completed
View comments (35)
Next question

Let’s say you work for Meta. You are given the table messenger_sends. Find the total number of unique conversation threads.

Note: In some entries, the receiver_id and sender_id are switched from the initial message. These entries should be treated as part of the same thread.

Example:

Input:

messenger_sends table

Column Type
id INTEGER
receiver_id INTEGER
sender_id INTEGER

Output:

Column Type
total_conv_threads INTEGER
.
.
.
.
.


Comments

Loading comments..