Saturday, 19 January 2013

Facebook Interview Experience


You can find some general tips for interviewing with facebook here (posted by a Facebook Engineer). Following questions are from Facebook's final interview rounds (for Software Engineer position):

Round 1
1) Given a string and some characters in a linked list write a function to return if the string is a palindrome or not ignoring all the characters in the linked list.
Signature: bool isPalindrome(char*, node*)

2) Multiply two very large numbers given in the form of strings and return the result also as string.
Signature: char* multiply(char*, char*)

Round 2
3) Write an iterator for the postorder traversal of binary tree. The iterator should print elements in order of postorder traversal on every call to it.
Eg. class iterator{
       public:
       next();
} T;

Consider the following binary tree:


T.next() will print 2
T.next() again will print 5
T.next() again will print 11
T.next() again will print 6 and so on.
so, kth call to next() should print kth node in the postorder traversal.

4) Given two arrays of integers find their intersection. FollowUp: What if one of the arrays is very much bigger than the other. What if one of them is too big to be in the memory.

Round 3
5) Find the longest common contiguous substring of two given strings.

Round 4
6) Given a binary tree write a function to join all the nodes at the same level. Consider each node to have a next pointer.

7) HR Questions:
  • Tell me about yourself
  • Projects & Internships
  • One conflict with team mates and how did u deal with it 
  • Where would you like to work? India or US? Why? 
  • One thing you would want to change on facebook 
  • One thing about facebook that excites you the most


Source: Some student at IIT-Guwahati.

No comments:

Post a Comment