Prepin
Log in

Create a "people you might know" feature.

Approach / Explanation

This question asks you to create a system akin to Facebook's "people you may know" feature. The objective is to develop a system that can analyze and forecast individuals a user may know or wish to connect with using an algorithm. To address this question, you must identify and define the potential inputs for the system (such as user data and interaction history), explain how the system processes these inputs, and outline how it generates its predictions. Additionally, you should take into account the scalability of your design (i.e., its ability to manage a large number of users), the efficiency of the algorithm you propose, and considerations around user privacy. Key aspects to cover in your response include: Identifying the inputs required by your system. Describing your algorithm for predicting potential connections for the user. Explaining how the system manages output and displays it to the user. Addressing scalability, efficiency, and privacy concerns.

Suggested Answer

The "people you may know" feature could utilize various data sources as inputs: the user's contact list, the contact lists of the user's friends, common activities or interests, and users located in the same area. Our algorithm could employ a clustering technique. Users are grouped into clusters based on a similarity metric that considers their interactions, interests, geographical location, and more. To determine potential acquaintances for a user, we examine other users within their cluster. The system then provides the user with a list of recommendations, which may be ranked according to the strength of the suggestion. Regarding scalability, the clustering algorithm can be executed in a distributed fashion. For efficiency, if the recommendation list for each user becomes too extensive, we can apply a sampling method to show only a random selection. In terms of privacy, users should have the option to opt out of this feature, and only data from those who have opted in should be utilized as inputs.

Alternative Answer

The inputs for the system will consist of the user's interaction data, including whom they have messaged, along with basic demographic details and their geographical location. The primary algorithm employed is based on graph theory, where each user is represented as a node and their interactions are represented as edges. This allows us to identify "friendship" nodes that the user has not yet engaged with but are strongly linked within their network. The system's output will be a ranked list of these potential "friendship" nodes presented to the user, ideally ordered by the strength of their connections. To ensure scalability and efficiency, the system will require caching mechanisms to store and quickly access data. It may be necessary to run the algorithm at intervals and save the results for rapid retrieval instead of executing it in real-time. Privacy is a critical concern since we are handling personal data, so adherence to GDPR guidelines or any applicable privacy policies is essential to ensure that we only utilize data that users have consented to share for this purpose.

Question Details

Difficulty & Category

Medium
system design

Product

For CandidatesFor RecruitersCompaniesBrowse JobsInterview QuestionsDeep ProfileSkill AssessmentOpportunity Matching
Prepin.ai

© 2026 Prepin LLC · Philadelphia, PA · All rights reserved.