facebook logo

Facebook Interviews

6 experiences21 reads36 questions50% success rate
Facebook onsite
facebook logo
Facebook
No Offer
January 26, 20222 reads

Summary

I'm sharing my onsite interview experience at Facebook, outlining the specific LeetCode problems I encountered. Additionally, I've provided a comparison of interview difficulties across various tech giants, and I'm happy to report that I ultimately received an offer from Google.

Full Experience

I recently navigated the onsite interview process at Facebook, and I've detailed the specific LeetCode problems I encountered during my rounds below. Having also interviewed with Google, Amazon, and Apple, I've developed a perspective on the relative difficulty of securing a position at each. In my experience, Facebook felt somewhat more accessible than Google, particularly if one has thoroughly prepared using the Facebook-tagged questions on LeetCode; I personally didn't encounter any questions that weren't already on LeetCode. On a difficulty scale, I'd rate Google around a 9, Facebook a 7 (or even a 5 if you've mastered their tagged questions), Apple a 5, and Amazon a 2 or 3, as it primarily focused on fundamental concepts. Although this post recounts my Facebook experience, I ultimately accepted an offer from Google, and things have been going great there. To anyone currently interviewing, keep up the excellent work – you'll achieve your goals!

Interview Questions (4)

Q1
Copy List with Random Pointer
Data Structures & AlgorithmsMedium

A linked list is given such that each node contains an additional random pointer, which could point to any node in the list or null. Construct a deep copy of the list.

Q2
Minimum Remove to Make Valid Parentheses
Data Structures & AlgorithmsMedium

Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and return any valid string.

Q3
Custom Sort String
Data Structures & AlgorithmsMedium

You are given two strings, order and s. All the characters of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a character y in order, then x should occur before y in the permuted string. Return any such string.

Q4
Word Search
Data Structures & AlgorithmsMedium

Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where 'adjacent' cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

Preparation Tips

My primary preparation strategy for Facebook was to thoroughly review and practice all the Facebook-tagged questions available on LeetCode. I found this approach highly effective, as I encountered no non-LeetCode questions during my entire interview process.

✅ Facebook | E5 | Phone Screen + Virtual Onsite
facebook logo
Facebook
sr software engineer e5Ongoing
December 11, 20214 reads

Summary

I recently completed my virtual onsite interview with facebook for the Sr Software Engineer (E5) position. The process included a phone screen and several onsite rounds covering coding, system design, and behavioral aspects. I received positive feedback from my interviewers and am currently awaiting the final decision from the hiring committee.

Full Experience

Last week, I had my virtual onsite interview with facebook for the Sr Software Engineer (E5) position. The overall experience was great.

Phone Screen

This was a 45-minute round where the interviewer asked two coding questions. I focused on understanding the problem, clarifying any ambiguities, and then verbally explaining my solution along with its time and space complexity. Once the interviewer was satisfied, I quickly implemented the solution and performed a dry run with test cases, including corner cases, finally explaining the complexity of my written code.

Virtual Onsite

The virtual onsite consisted of four 45-minute rounds: two Coding Rounds (Ninja), one System Design Round (Pirate), and one Behavioral Round (Jedi).

Coding Round 1:

Similar to the phone screen, I was given two coding problems to solve, applying my structured approach of understanding, verbalizing, implementing, and verifying.

System Design Round:

I was asked to design the privacy settings at facebook. I spent approximately 40 minutes discussing the design, and used the remaining 5 minutes to ask questions about facebook's culture.

Coding Round 2:

This round also involved two coding questions, where I applied my standard approach for solving them.

Behavioral Round:

The interviewer started by asking me about myself, my current project, and significant accomplishments. I was also asked if I had ever managed conflicting priorities and if I had received constructive feedback from a colleague. For each behavioral question, I provided a supporting anecdote from my past experiences, ensuring my answers aligned with facebook's mission and core values. Interestingly, this round also included one coding question.

Two days after my virtual onsite, I received a call from the recruiter informing me that the feedback from my interviewers was good, and they are still waiting for the hiring committee to make the final decision.

Interview Questions (10)

Q1
Lowest Common Ancestor of a Binary Tree III
Data Structures & Algorithms

Given two nodes, node1 and node2, in a binary tree, where each node also has a pointer to its parent. Find their lowest common ancestor.

Q2
Dot Product of Two Sparse Vectors
Data Structures & Algorithms

Implement a method to compute the dot product of two sparse vectors.

Q3
Verifying an Alien Dictionary
Data Structures & Algorithms

Given a sequence of words and an alphabet ordering, determine if the words are sorted lexicographically in the alien language.

Q4
Kth Largest Element in an Array
Data Structures & Algorithms

Find the kth largest element in an unsorted array.

Q5
Design Privacy Settings
System Design

I was asked to design the privacy settings system at facebook.

Q6
Merge Sorted Array
Data Structures & Algorithms

Merge two sorted arrays into one sorted array, where the first array has enough space to hold elements from both.

Q7
Convert Binary Search Tree to Sorted Doubly Linked List
Data Structures & Algorithms

Convert a Binary Search Tree (BST) into a sorted circular doubly-linked list in-place.

Q8
Managing Conflicting Priorities
Behavioral

Have you ever had to manage conflicting priorities? Describe the situation and how you handled it.

Q9
Receiving Constructive Feedback
Behavioral

Have you ever received constructive feedback from a colleague? How did you respond to it?

Q10
Diameter of Binary Tree
Data Structures & Algorithms

Find the length of the diameter of a binary tree.

Preparation Tips

My general approach for answering coding questions involved:

  1. Thoroughly understanding the problem and asking clarifying questions.
  2. Verbally explaining my proposed solution, including the expected time and space complexity.
  3. Once the interviewer was satisfied with the verbal explanation, quickly implementing the solution.
  4. Performing a dry run with a few test cases, covering corner cases.
  5. Explaining the time and space complexity of the written solution.

For behavioral questions, I focused on providing supporting anecdotes from my experience and making sure my answers were in-line with facebook's mission and core values.

Facebook | E4 | London | Interview Experience
facebook logo
Facebook
E4London3 yearsOngoing
August 10, 20214 reads

Summary

I interviewed with Facebook for an E4 role in London, tackling various coding challenges, system design, and behavioral questions across multiple rounds, and I am currently awaiting the outcome.

Full Experience

Hey Everyone,

I interviewed with Facebook for an E4 role in London. I am currently waiting to hear back from them regarding the outcome of my interviews.

Phone Screen:

This round involved two coding questions. I felt confident in my ability to solve both on time.

  1. Binary Tree to Doubly linked List.
  2. Evaluating expression (Only with +/* operators).

Onsite Coding 1:

I successfully solved both problems presented in this round within the given time frame.

  1. Multiplying 2 strings.
  2. Course Schedule problem on LeetCode.

Onsite Coding 2:

Only one question was asked in this round. I was able to solve it on time, even though I required one hint from the interviewer. Overall, the interviewer seemed convinced by my solution.

  1. LFU Cache Implementation.

Behavioral:

This round consisted of standard behavioral questions and some inquiries about my past work experience. I managed to tackle all the questions well, with only one or two proving to be a bit tricky.

System Design:

The challenge here was to design a system similar to Google Drive. I was able to approach the problem, but the interviewer continuously introduced new scenarios. I could answer some of these, but got stuck on others. I feel this round went below average to average.

Interview Questions (6)

Q1
Convert Binary Tree to Doubly Linked List
Data Structures & AlgorithmsMedium

Convert a binary tree into a circular doubly linked list in-place. The left and right pointers of the tree nodes should be used as previous and next pointers respectively in the doubly linked list.

Q2
Evaluate Expression with Basic Operators (+, *)
Data Structures & AlgorithmsMedium

Implement a basic calculator to evaluate a simple expression string that may contain integers and the operators '+' and '*'. The expression string does not contain any parentheses, division, or subtraction. Assume the given expression is always valid.

Q3
Multiply Strings
Data Structures & AlgorithmsMedium

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Do not use any built-in BigInteger library or convert the inputs to integers directly.

Q4
Course Schedule
Data Structures & AlgorithmsMedium

There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. Return true if you can finish all courses. Otherwise, return false.

Q5
LFU Cache
Data Structures & AlgorithmsHard

Design and implement a data structure for a Least Frequently Used (LFU) cache. It should support get and put operations with O(1) average time complexity. When the cache reaches its capacity, it should invalidate the least frequently used item. If there is a tie in frequency, invalidate the least recently used item among them.

Q6
Design Google Drive
System Design

Design a system like Google Drive, focusing on aspects such as file storage (e.g., block storage, deduplication), synchronization across multiple devices, versioning of files, access control and permissions, and overall system scalability and reliability.

Preparation Tips

For my preparation, I primarily used LeetCode for algorithm and data structure questions. For System Design, I relied exclusively on YouTube resources.

Facebook E5 London Offer
facebook logo
Facebook
Lead Engineerlondon12 yearsOffer
March 30, 20214 reads

Summary

I successfully navigated the E5 Lead Engineer interview process at Facebook in London, securing an offer after a series of technical, behavioral, and system design rounds.

Full Experience

I had an interview for an E5 Lead Engineer position at Facebook in London. My experience level was 12 years.

Talk with the recruiter (30 mins):

This discussion was crucial for setting my expectations and understanding the interview process. The recruiter provided valuable insights and resources for preparation. I treated this as an interview itself, asking all my questions about the preparation process.

Technical Phone Screen (45 mins):

I was asked two coding questions in this round. Both were relatively easy, and the key was to articulate my thought process clearly. I made sure to test my code immediately after writing it, which impressed the interviewer.

Virtual Onsite (4 rounds):

Behavioral (45 mins):

This round focused on my past experiences in teams and how I handled technical challenges. The questions were open-ended, and each answer led to follow-up questions. I wasn't asked any coding questions in this round. My recruiter had mentioned that a strong positive signal in this round is critical, as a negative signal here can lead to a 'no-hire' decision even with strong technical performance.

System/Product Design (45 mins):

I was tasked with designing a file-sharing system similar to Dropbox. During requirement gathering, I pointed out a potential security issue with auto-sync, which seemed to impress the interviewer. My proposal for staggered scale-up based on usage trends also received positive feedback. I drove the discussion, answering clarification questions and providing high-level differences between SQL and NoSQL without getting bogged down in details.

Coding 1 (45 mins):

This round was similar to the phone screen but with a higher bar. I tackled two coding problems. The first involved a LeetCode problem, where I used Breadth-First Traversal and discussed follow-up questions on parallelization and memory constraints. The second was another LeetCode problem, which I solved very quickly.

Coding 2 (45 mins):

I faced two more coding questions here. For the first, which involved checking interval coverage, I initially missed a boundary case but caught and fixed it during testing without prompting, which was viewed positively. For the second, finding connected sub-graphs in an undirected graph, I used Depth-First Traversal. I ran out of time to complete the code, but because I had modularized my solution, I could clearly outline the remaining implementation details for the interviewer.

The next day, I received positive feedback from my recruiter for all four rounds and was informed that I would proceed to the review board. The offer came through the day after that.

Interview Questions (7)

Q1
Sum of Root-to-Leaf Paths in Binary Tree
Data Structures & AlgorithmsEasy

Given a binary tree of integers, write a function that returns the sums of all the root-to-leaf paths.

Q2
Arithmetic Expression Evaluator (Addition & Multiplication)
Data Structures & AlgorithmsEasy

Given a string representing an arithmetic expression with only addition and multiplication operators, return the result of the calculation.

Q3
Design Dropbox
System Design

Design a file sharing system similar to Dropbox. I discussed potential security issues with auto-sync, proposed staggered scale-up based on usage trends, and drove the design discussion, keeping it high-level and focused on requirements.

Q4
Find Largest Value in Each Tree Row
Data Structures & AlgorithmsMedium

Solve LeetCode problem 'Find Largest Value in Each Tree Row' using Breadth First Traversal (queue based approach).

Q5
Valid Palindrome II
Data Structures & AlgorithmsEasy

Solve LeetCode problem 'Valid Palindrome II'.

Q6
Check Interval Coverage
Data Structures & AlgorithmsMedium

Given two integers X and Y (X<Y) and a list of intervals [(i,j)...] (where i is the start and j is the end of the interval), find if the intervals completely cover the given integer range [X,Y]. The intervals are sorted according to their start value. Example1: X=1, Y=6, List: [[1, 3], [3, 5]], output: true; Example2: X=3, Y=5, List: [[1, 4], [4, 7]], output: false.

Q7
List Connected Components in Undirected Graph
Data Structures & AlgorithmsMedium

Given an undirected graph (represented by pairs of nodes), list all connected sub-graphs (components).

Preparation Tips

Tips from my experience:

  • Treat the recruiter call as an interview and an opportunity to ask about preparation resources and tips. Recruiters can be very helpful.
  • For behavioral interviews, being genuine and self-critical goes a long way. Have significant projects from your CV ready with narratives, and be prepared for follow-up questions.
  • For system design, keep the design high-level unless specifically asked to dive deeper. Stay focused on requirements and design a working solution. It's crucial to understand concepts in depth; avoid name-dropping technologies you can't elaborate on. At the same time, keep the big picture in mind and don't get lost in details.
  • For coding rounds, always talk through your thought process and test your code without waiting for the interviewer to prompt you. This creates a positive impression.

Recommended Resources:

📌 Facebook | E5 | Bay Area | Phone Screen
facebook logo
Facebook
Software Engineer E5Bay AreaOffer
March 13, 20213 reads

Summary

I successfully navigated my phone screen interview at Facebook for an E5 role in the Bay Area, demonstrating optimal solutions for two coding problems and ultimately receiving an offer.

Full Experience

I had my Facebook E5 phone screen interview, which lasted for 45 minutes. We started with a brief 3-5 minute introduction. The interviewer then clarified that the majority of the time would be dedicated to problem-solving, reserving the last 5 minutes for my questions.

The first question I encountered was Add Binary. Having practiced this problem before, I immediately explained the optimal approach, achieving a time complexity of O(max(l1, l2)). The interviewer was satisfied with my algorithm, and I quickly proceeded to code the solution in Java. After coding, I walked through my solution with a few examples. This entire segment, including discussion and coding, was completed within 10-15 minutes.

/**
 * Time Complexity: O(max(l1, l2))
 * Space Complexity: O(max(l1, l2))
 * l1 = Length of string A, l2 = Length of string B.
 */
public String addBinary(String a, String b) {
    if (a == null && b == null) {
        return "0";
    }
StringBuilder result = new StringBuilder();

int i = a.length() - 1;
int j = b.length() - 1;
int carry = 0;

while (i >= 0 || j >= 0) {
    int sum = carry;
    if (i >= 0) {
        sum += a.charAt(i) - '0';
        i--;
    }
    if (j >= 0) {
        sum += b.charAt(j) - '0';
        j--;
    }
    result.append(sum % 2);
    carry = sum / 2;
}

if (carry == 1) {
    result.append('1');
}

return result.reverse().toString();

}

Following that, the second question was Merge Intervals. Again, I was familiar with this problem and presented the optimal O(NlogN) approach. Once the interviewer approved the algorithm, I implemented the solution in Java and demonstrated its functionality with test cases. This question took approximately 20-25 minutes to complete.

/**
 * Time Complexity O(N log N)
 * Space Complexity: O(N) (Including the List<int[]> result)
 * N = Length of input array.
 */
public int[][] merge(int[][] intervals) {
    if (intervals == null || intervals.length <= 1) {
        return intervals;
    }
Arrays.sort(intervals, (a, b) -&gt; (a[0] - b[0]));

List&lt;int[]&gt; result = new ArrayList&lt;&gt;();
int start = intervals[0][0];
int end = intervals[0][1];

for (int i = 1; i &lt; intervals.length; i++) {
    if (intervals[i][0] &lt;= end) {
        end = Math.max(end, intervals[i][1]);
    } else {
        result.add(new int[] { start, end });
        start = intervals[i][0];
        end = intervals[i][1];
    }
}

result.add(new int[] { start, end });
return result.toArray(new int[result.size()][2]);

}

With a few minutes remaining, I took the opportunity to ask the interviewer two questions about their current work at Facebook. I was thrilled to later receive a call from the recruiter informing me of positive feedback from the hiring committee and that an offer would be extended.

Interview Questions (2)

Q1
Add Binary
Data Structures & AlgorithmsEasy

Given two binary strings a and b, return their sum as a binary string.

Q2
Merge Intervals
Data Structures & AlgorithmsMedium

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

Preparation Tips

My preparation focused on completing as many LeetCode questions as possible, especially those recently tagged with Facebook. This approach proved highly beneficial, allowing me to solve both interview problems optimally and within the strict time constraints.

📌 Facebook | E5 | Bay Area | Virtual Onsite
facebook logo
Facebook
software engineer e5bay areaOngoing
March 6, 20214 reads

Summary

I recently completed a virtual onsite interview for an E5 Software Engineer role at Facebook in the Bay Area, which consisted of two coding rounds, one system design round, and a behavioral round that also included a small coding problem.

Full Experience

I recently had a virtual onsite interview with Facebook for an E5 Software Engineer role in the Bay Area. The process involved four 45-minute rounds: two focused on coding, one on system design, and a behavioral round which surprisingly also included a small coding problem.

1st Coding Interview

The first coding round started with a problem similar to Intersection of Two Linked Lists, but presented in the context of a binary tree. I was asked to find the Lowest Common Ancestor (LCA) of two nodes in a binary tree, where each node only had a parent pointer. Initially, it took me a moment to connect it to the linked list intersection concept, but I eventually figured it out without any hints. I implemented a two-pointer solution in Java, achieving O(n) time complexity and O(1) space complexity. After walking through my code with a few examples, the interviewer seemed pleased. We then moved to a second coding question: Leftmost Column with at Least a One, which was identical to the problem found on LeetCode. I provided an optimal solution for this as well.

2nd Coding Round

In my second coding round, I tackled two problems. The first was Range Sum of BST, and the second was Trapping Rain Water. Both were exactly as they appear on LeetCode. I developed optimal solutions in Java for both. For the first question, the interviewer requested a few examples and base cases to test my solution. Unfortunately, we ran out of time before I could thoroughly walk through the solution for the second problem.

System Design Interview

The system design interview challenged me to design a Proximity Server. The core requirement was to, given a location's latitude and longitude, find all nearby places within a specified radius. I began by clarifying the essential features and discussing the design goals and potential scale. I then outlined a high-level design of the APIs. A significant portion of my discussion focused on the data structures and algorithms for efficiently finding nearby places; I proposed using a Quad Tree to represent geographical grids and store locations. I also delved into sharding strategies, briefly explaining Consistent Hashing, and the importance of caching for quick data retrieval. Additionally, I touched upon the application layer, mentioning stateless machines and load balancers. I later found a helpful video on this topic here.

Behavior Round

The behavioral round primarily centered on my projects at my current company. The interviewer also posed questions related to conflict resolution, how I've made an impact outside my immediate team, and my approach to problem-solving when faced with limited information. For each of these, I drew upon my past experiences to provide concrete examples. Towards the end, a simple coding problem was introduced: Valid Palindrome. I believe I performed well in this round, effectively communicating my experiences and solving the coding challenge.

Overall, I feel the interview went quite well. I've received an email from the recruiter indicating that it might take up to a week to hear back about the result. So, I'm keeping my fingers crossed!

Interview Questions (7)

Q1
Lowest Common Ancestor of Binary Tree with Parent Pointer
Data Structures & AlgorithmsMedium

Given two nodes in a binary tree, find their lowest common ancestor. Each node has a parent pointer. This is similar to LeetCode's Intersection of Two Linked Lists or Lowest Common Ancestor of a Binary Tree Part III.

Q2
Leftmost Column with at Least a One
Data Structures & AlgorithmsMedium

Given a row-sorted binary matrix, return the index of the leftmost column that contains at least one 1. You can only access the matrix using a special BinaryMatrix interface.

Q3
Range Sum of BST
Data Structures & AlgorithmsEasy

Given the root of a binary search tree and two integers low and high, return the sum of all node values v such that low <= v <= high.

Q4
Trapping Rain Water
Data Structures & AlgorithmsHard

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

Q5
Design a Proximity Server
System Design

Design a system that, given the latitude and longitude of a location, can find all nearby places within a given radius.

Q6
Behavioral Questions: Project Impact, Conflict Resolution, and Problem Solving
Behavioral

Questions covered my projects at my current company, conflict resolution, demonstrating impact outside the team, and approaching problems with limited information.

Q7
Valid Palindrome
Data Structures & AlgorithmsEasy

Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

Preparation Tips

My preparation journey was significantly aided by the LeetCode Community. Their support and resources over the past few months were invaluable in honing my skills. For a more detailed breakdown of my strategy, I've shared my full interview preparation journey here.

Have a Facebook Interview Experience to Share?

Help other candidates by sharing your interview experience. Your insights could make the difference for someone preparing for their dream job at Facebook.