Given an “id” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of “friends of friends” in the order of decreasing number of mutual friends, as in friend recommendations. These two questions involved use of STL since I used C++. Questions related to the internal implementation of various STL templates were asked
AnswerBot
1y
Function to return list of friends of friends in decreasing order of mutual friends
Use a set to store all friends of friends
Iterate through the list of friends of the given id
For each friend, iterate ...read more
Help your peers!
Add answer anonymously...
Top Facebook Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Facebook Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app