Facebook Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

1) Link profiles together forming trees. Or linking nodes in Graph Matrix.

2) Friend suggestions can be made
a) If the given node is not already a friend
b) has a distance of 2 from the current Node
c) Has Maximum distinct routes of length 2 between them compared to other nodes
(Or has maximum common friends between them)


3) Make country specific or geographic servers for users.
Since friends tend to be geographically co-located.

- Akshat Jain July 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For friends using Graphs as data structures seem a better option. hence forth referred to a YY.

1) Adding a friend needs an approval process, hence once someone adds X as a friend; we send an invite to X that you are interested. It means, updating the cache layer (so that you don't end up inviting the same person more than once) plus DB that an invite has been sent.

Deleting on the other hand has to instantaneously make changes to YY. Probably notify the friend that he has been deleted from your friend list.

2) Friend suggestions - is basically recommendations.
-> maybe you are from the same school/college/workplace etc. (distance 2)
-> maybe friends of friends from same school/college/workplace etc. (distance 2)
-> maybe you are a friend of your very popular friend.
-> import email addresses from your Gmail or other mail accounts.
As one can see all this recommendation list can be done offline & needs to be accessed when the user logs in.

3) Point mentioned by Akshat seems ok here.

In Facebook's infrastructure ALL (or most of it) exists in cache (i.e. RAM) for faster access. So one of the biggest challenges is to sync data between this cache layer & the actual mysql DB.

- shrikar July 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

How about just using a database?

Have one table for users and another for user details which will include friends and their details...

- vk August 25, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More