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...
Facebook Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter