College: Bits Pilani
Facebook visited our campus in July, 2012. We had an online coding round hosted on InterviewStreet. We were asked to solve just one problem. The given problem boils down to : Given a undirected graph, source and destination, write the code to find the total number of distinct nodes visited, considering all possible paths.
Those shortlisted had to fly to Delhi for a Personal Interview. There were four rounds of interview, each of 45 minutes. The questions were simple. But just solving the given problem wasn’t enough.
There was much more interaction and short questions asked related to the problem.
The following questions were asked during the interview.
Q1. Given two “ids” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of mutual friends.
Q2. 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.
Q3. Given a number of time slots – start time and end time,“a b”, find any specific time with the maximum number of overlapping. After solving the problem I had to prove my solution.
Q4. Given an array of Integers, find the Longest sub-array whose elements are in Increasing Order.
Q5. Given an array of Integers, find the length of Longest Increasing Subsequence and print the sequence.
Q6. Given a Sorted Array which has been rotated, write the code to find a given Integer.
Q7. You have a number of incoming Integers, all of which cannot be stored into memory. We need to print largest K numbers at the end of input.
Q8. Implement LRU Cache.
For every solution I was asked to write the code on paper. The code should also include the implementation of the data structures used (I used heaps – so I was asked to implement heaps ). They are looking for someone with good problem solving skills and conceptually sound in data structures.
Thanks Prakah V. for contributing this article. If you would like to contribute, mail us your interview experience at [email protected] We will like to publish it on CrazyforCode and help other job seekers.