Meta
Recommendation Lab
Friend recommendation, feed ranking, trending algorithm, product recommendation
Walkthrough
How Meta Recommendations Work
Step-by-step from social graph to personalized feed
Users & Social Graph
Meta's social graph connects users through friendships, follows, and interactions. Each node is a user, each edge represents a relationship. This graph has billions of nodes and trillions of edges.
Algorithms
Log
Algorithm
BFS traverses the social graph level by level.
Start → direct friends → their unvisited neighbors = recommendations.
Complexity
Interview Qs
Design friend recommendation for 2B users.
Graph partitioning, BFS with depth limit, ANN search.
Rank a feed with 1000+ signals per post.
ML ranker + priority queue. Consider fairness & diversity.
Design real-time trending topics.
Sliding window + max-heap per time bucket. Shard by geography.
Build e-commerce product recommendation.
Collaborative + content-based filtering. Matrix factorization.
Coding Challenge
Practice on Terminal
Write and submit your solution, then check achievements
Given a social network graph where each node is a user and edges represent friendships, recommend the top K most relevant friend suggestions for a given user. A suggested friend should be ranked by the number of mutual friends (higher is better), then by user ID (lower is better).