Days Until a New Facebook User Reaches Ten Friends
Last updated: November 29, 2026
Quick Overview
For users who signed up in January, compute how many days it took each to reach their tenth confirmed friend, then report the share who got there within 7, 14 and 30 days of signup.
Meta
November 29, 20260
0
0 solved
For users who signed up in January, compute how many days it took each to reach their tenth confirmed friend, then report the share who got there within 7, 14 and 30 days of signup.
Reaching a friend threshold quickly is one of the best-known leading indicators of long-term Facebook retention, and growth interviews at Meta often revolve around it. The interviewer checks that you count friendships from both sides of an undirected edge and pick the tenth with ROW_NUMBER.
What the Interviewer Expects
- Unions both directions of the undirected friendship table so each user sees all their friends
- Numbers each user's friendships by time and selects the tenth
- Joins to signups and computes days from signup to the tenth friend
- Keeps users who never reached ten in the denominator
- Reports cumulative shares at several cutoffs in one pass
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you check whether the 'ten friends' threshold is actually the right one, rather than seven or fifteen?
- How would you exclude friendships that were later removed?
- How would you compare time-to-ten-friends between users who imported contacts at signup and those who did not?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Tables:
users(user_id, signup_at)friendships(user_low, user_high, confirmed_at), one row per undirected pair withuser_low < user_high.
I will consider the cohort as signups from Jan 1 to ...
Approach
- Explode the pair table into
(user_id, friend_id, confirmed_at)for both endpoints. ROW_NUMBER()per user ordered byconfirmed_at.- Keep the tenth row, left join it onto the January cohor...