facebook logo

Facebook Interviews

12 experiences309 reads166 questions33% success rate
Facebook onsite
facebook logo
Facebook
No Offer
January 26, 202226 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, 202124 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 | Android E4 | Remote | Reject
facebook logo
Facebook
android e4remoteRejected
August 17, 202131 reads

Summary

I interviewed for an Android E4 role at Facebook, navigating a technical phone screen and a four-round virtual onsite focused on coding, system design, and behavioral aspects. Despite successfully resolving most challenges, my application ultimately resulted in a rejection.

Full Experience

Technical Phone Screen

My interview process began with a technical phone screen. I was given two coding questions, with no Android-specific problems. I successfully resolved both problems within 40 minutes, which allowed me to proceed to the virtual onsite interview.

Virtual Onsite Interview

The virtual onsite consisted of four rounds: two coding interviews, one system design interview, and one behavioral interview.

1st Coding Round

In this round, I encountered two coding problems. I managed to resolve both questions in under 40 minutes. For the first problem, I achieved an O(n^2) solution, and for the second, an O(nlogn) solution.

2nd Coding Round

The second coding round also presented two coding questions. I resolved both of these within 40 minutes, delivering an O(n) solution for the first problem and an O(n^2) solution for the second.

Design Round

The design interview focused on designing the Instagram home screen. After clarifying the requirements, I discussed authentication with Facebook, how to handle a large volume of posts, the constraint of each post having only one image, liking/disliking functionality, displaying user profile photos, and critically, how the app would support an offline mode. My discussion covered RecyclerView optimizations, image caching strategies (including the underlying mechanics of libraries like Glide/Picasso), WorkManager, batching requests, and pagination. I was initially quite nervous about this round, but I felt I performed really well in the end.

Behavioral Round

This round was primarily a conversational interview. I was asked to share examples from my past experiences related to specific situations, such as receiving ambiguous requirements or working with colleagues I disliked. I believe I handled the initial part of this round effectively. Towards the end, I was given a coding question which I resolved pretty quickly with an O(n) solution, although I think I might have missed some edge cases, like empty spaces at the beginning of the input. However, the interviewer seemed content with my solution.

Interview Questions (9)

Q1
Product of Array Except Self
Data Structures & Algorithms

Given an array of n integers, return an array of n integers where at each position 0 <= i < n contains the multiplication of all the integers in the original array, except the one at the position i.

Q2
Random Pick Index of Highest Number
Data Structures & Algorithms

Given an array of n integers, return using a normal distribution any index i that belongs to the highest integer in the array. This is similar to LeetCode problem 'Random Pick Index', but the target is specifically the highest number in the array.

Q3
Valid Palindrome II
Data Structures & Algorithms

Given a string s, return true if it is a palindrome, or if it can be a palindrome after deleting at most one character.

Q4
Next Permutation
Data Structures & Algorithms

Given an array of n integers, return its next permutation.

Q5
Minimum Add to Make Parentheses Valid
Data Structures & Algorithms

Given a string with parentheses, return how many parentheses we need to add to make it valid.

Q6
Remove All Adjacent Duplicates In String
Data Structures & Algorithms

Given a string, simulate the 'deletion' process similar to Candy Crush in 1D. The resulting string should not contain two identical characters next to each other.

Q7
Design Instagram Home Screen
System Design

Design the Instagram home screen, including requirements such as authentication with Facebook, handling a large list of posts (each with one image), like/dislike functionality, displaying user profile photos, and supporting an offline mode.

Q8
Behavioral Questions: Ambiguous Requirements, Disliked Coworker
Behavioral

Behavioral questions involved discussing past experiences, specifically situations where I faced ambiguous requirements or had to work with someone I disliked.

Q9
String to Integer (atoi)
Data Structures & Algorithms

Given an array of characters, return its number representation, ignoring any characters that are not numbers.

Preparation Tips

My LeetCode preparation involved completing 64.2% of easy problems, 49.3% of medium problems, and 35.3% of hard problems. I also practiced competitive programming on Codeforces.

Facebook | E4 | London | Interview Experience
facebook logo
Facebook
E4London3 yearsOngoing
August 10, 202129 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 | E6 | London [Reject]
facebook logo
Facebook
londonRejected
April 30, 202125 reads

Summary

I interviewed for an E6 Software Engineer position at facebook in London and was rejected, primarily because I needed to improve my depth in system design during the product design rounds, despite strong performance in coding and behavioral interviews.

Full Experience

I was referred to a recruiter by a friend who had previously interviewed at facebook. The entire interview process spanned about a month and a half, starting in March and concluding in mid-April. Each round was 45 minutes long, with coding rounds featuring two questions each.

Screening Round:

I faced two coding questions. One was related to palindromes (though the exact problem isn't shared), and the other involved finding a path in a given binary tree. For the binary tree problem, I also had follow-up questions to solve it without using a global variable and to adapt the solution for any n-ary tree. I managed to complete both questions within 35 minutes, and the feedback was very positive, leading to an E6 position consideration.

Coding Round 1:

This round also had two coding problems. The first was about merging two sorted arrays. The second involved merging contacts with domain names into the minimum number of groups; the interviewer suggested treating contacts as graph nodes, generating edges for common domains, and then using DFS for connected components. The feedback for this round was good.

Coding Round 2:

Again, two coding questions. One asked me to find an element in an array and return a random index if multiple occurrences existed. The second problem involved using two given APIs, move() and isTarget(), to determine if a target was present in a grid that contained a source and target at some positions. I solved both of these with some hints from the interviewer, and the feedback was good.

Product Design Round 1:

As I was interviewing for an E6 position, there were two technical product design rounds. The first involved designing an API for a newsfeed, similar to Instagram or Facebook, while considering multiple client types. The feedback was that I needed to discuss more about the scalability of the system.

Product Design Round 2:

The second product design round focused on designing a system to handle live comments for videos. The feedback indicated that I needed to delve more into the low-level details of the system.

Behavioral Round:

This round consisted of standard behavioral questions based on my past experience, covering situations like handling teams, conflict management, and my learnings over the last 2-3 years. The feedback was positive.

Ultimately, considering the feedback from the product design rounds, I received a rejection. The recruiter explained that product design is a very critical component for E5 and E6 positions, and despite very good feedback in other rounds, they had to reject me on that basis. I hope my experience can be helpful to others.

Interview Questions (7)

Q1
Find Path in Binary Tree
Data Structures & Algorithms

I was asked to find a path in a given binary tree. I also had two follow-ups: first, to solve it without using a global variable for the answer, and second, to adapt the solution for any n-ary tree.

Q2
Merge Two Sorted Arrays
Data Structures & Algorithms

I was given the problem of merging two sorted arrays.

Q3
Merge Contacts by Common Domain
Data Structures & Algorithms

I needed to merge given contacts with domain names into the minimum number of groups, where groups having common domains should be merged. The approach was to treat contacts as nodes in a graph, generate edge information with contacts having common domain name. Then do DFS on the nodes and group them as connected components.

Q4
Find Element in Array with Random Index
Data Structures & Algorithms

I had to find an element in an array and, if there were multiple occurrences, return a random index each time.

Q5
Find Target in Grid using APIs
Data Structures & Algorithms

Given two APIs, move() and isTarget(), I needed to find if a target was present in a grid that contained a source and target at some positions.

Q6
Design Newsfeed API
System Design

I was tasked with designing an API for a newsfeed, similar to Instagram or Facebook, considering multiple clients.

Q7
Design Live Comments System for Videos
System Design

I needed to design a system to handle live comments for videos.

Preparation Tips

My LeetCode status indicated I had solved close to 800 problems.

Facebook E5 London Offer
facebook logo
Facebook
Lead Engineerlondon12 yearsOffer
March 30, 202128 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 | Remote (Menlo Park) | Mar 2021 [Reject]
facebook logo
Facebook
E5Remote (Menlo Park)20 yearsRejected
March 15, 202123 reads

Summary

I had my final round of interviews for an E5 remote position at Facebook in March 2021, which unfortunately resulted in a rejection. I felt confident about the coding rounds, but the system design and product design questions were unexpected and challenging, ultimately leading to my downfall.

Full Experience

I had my final round of interviews for a remote E5 position with Facebook in March 2021. The interviews were conducted via video calls, utilizing CoderPad for coding and Excalidraw for design discussions.

My first coding round included two problems: Leftmost Column with a One and Kth Smallest Element in a Sorted Matrix.

The system design round presented the challenge to "Design a Load Balancer".

For the behavioral interview, I was asked several questions: "Can you tell me about a time you had to overcome obstacles in a project?", "Tell me about a time you had a conflict or disagreement with a colleague.", "Did you ever try to change something outside of your responsibility?", and "How do you handle vague requirements in a project?". There was also a coding question at the end of this round, which was to convert an array of numbers as characters to an actual integer; for example, converting ['1', '2', '3'] to 123.

In my second coding round, I tackled Merge 2 Sorted Arrays and Insert into a Sorted Circular Linked List.

The product design round focused on "Design a client library for a mobile phone that downloads media files (image, video, music/sound)".

About a week after the interviews, I received a rejection email that did not include any specific feedback. I felt pretty good about the coding rounds, as I was able to code solutions for all of them, and practicing problems on LeetCode definitely helped. Facebook also has its own interview prep coding problems, but I found them generally much easier than the ones on LeetCode.

I'm pretty sure the system and product design rounds were my downfall. I had been preparing for designing distributed systems for those rounds, so it threw me off when the system design focused only on one particular component of a system, and the product design was about something I don't have much experience with. Those two rounds were nothing like the system design prep videos I'd seen online. I felt very unprepared for them even after about two months of preparation. Live and learn, I suppose.

Interview Questions (11)

Q1
Leftmost Column with a One
Data Structures & Algorithms

Given a binary matrix, find the leftmost column that contains at least one 1.

Q2
Kth Smallest Element in a Sorted Matrix
Data Structures & Algorithms

Find the Kth smallest element in an n x n matrix where each row and column is sorted in ascending order.

Q3
Design a Load Balancer
System Design

Design a system for a load balancer.

Q4
Overcome Obstacles
Behavioral

Can you tell me about a time you had to overcome obstacles in a project?

Q5
Conflict or Disagreement with Colleague
Behavioral

Tell me about a time you had a conflict or disagreement with a colleague.

Q6
Change Something Outside Responsibility
Behavioral

Did you ever try to change something outside of your responsibility?

Q7
Handle Vague Requirements
Behavioral

How do you handle vague requirements in a project?

Q8
Convert Array of Character Numbers to Integer
Data Structures & Algorithms

Convert an array of numbers as characters to an actual integer. For example, convert ['1', '2', '3'] to 123.

Q9
Merge Sorted Array
Data Structures & Algorithms

Merge two sorted arrays into a single sorted array.

Q10
Insert into a Sorted Circular Linked List
Data Structures & Algorithms

Given a node in a circular linked list, insert a new element into the list such that the list remains sorted.

Q11
Design a Client Library for Mobile Media Downloads
System Design

Design a client library for a mobile phone that downloads media files (image, video, music/sound).

Preparation Tips

My preparation primarily involved practicing problems on LeetCode, which proved very beneficial for the coding rounds. I also utilized Facebook's own interview prep coding problems, though I found them generally easier than those on LeetCode. For system design, I prepared for about two months, focusing on distributed systems design. However, this preparation did not align well with the specific questions asked during the actual interview, particularly the product design aspect and the component-focused system design.

📌 Facebook | E5 | Bay Area | Phone Screen
facebook logo
Facebook
Software Engineer E5Bay AreaOffer
March 13, 202121 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, 202126 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.

👩‍💻 Facebook Interview | E5 Level | Bay Area | Accept
facebook logo
Facebook
e5bay area11 yearsOffer
February 20, 202127 reads

Summary

I successfully interviewed for an E5 position at Facebook in the Bay Area after a referral from a friend. The process involved a recruiter screen, a technical phone screen with two coding problems, and a virtual onsite covering two coding rounds, a system design challenge, and a behavioral round, ultimately leading to an offer.

Full Experience

I was referred by a friend at Facebook, which initiated my interview process for an E5 level position in the Bay Area.

Recruiter Phone Screen

The recruiter asked me about the details of my current job, my reasons for leaving, the status of any other ongoing interview processes or offers, and general questions like my visa status. We also discussed the target level for my interviews.

Technical Phone Screen

This 45-minute round focused purely on coding. After brief introductions, we dove straight into two questions. I spent about 15 minutes on the first question and 25 minutes on the second.

The questions were:

  1. Lowest Common Ancestor of a Binary Tree
  2. Integer to English Words

Virtual Onsite

All rounds during the virtual onsite were 45 minutes long.

Coding Round 1

I was given two coding problems in this round:

  1. Product of Array Except Self
  2. Clone Graph

Coding Round 2

This round also had two coding questions:

  1. Subarray Sum Equals K
  2. Minimum Remove to Make Valid Parentheses

System Design Round

I was tasked with designing the Facebook Status Search system. I utilized an iPad to explain my thought process and draw the architectural diagrams. A related discussion can be found here.

Behavior Round

This round covered various behavioral questions including discussions about my recent projects, reasons for leaving my current company, conflict resolution strategies, and experiences with difficult colleagues. Additionally, there was one coding question that was similar to First Bad Version.

My years of experience are 11. My compensation before the interview was $310K, and after receiving the offer, it increased to $381K plus a $50K sign-on bonus.

I wish everyone the best of luck with their upcoming interviews!

Interview Questions (8)

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

During the technical phone screen, I was asked to find the Lowest Common Ancestor of a Binary Tree. I spent around 15 minutes on this question.

Q2
Integer to English Words
Data Structures & Algorithms

In the technical phone screen, I was also asked to convert an integer to its English words representation. I spent about 25 minutes on this question.

Q3
Product of Array Except Self
Data Structures & Algorithms

In the first coding round of the virtual onsite, I was given the problem 'Product of Array Except Self'.

Q4
Clone Graph
Data Structures & Algorithms

The second question in the first coding round was 'Clone Graph'.

Q5
Subarray Sum Equals K
Data Structures & Algorithms

During the second coding round, one of the problems presented was 'Subarray Sum Equals K'.

Q6
Minimum Remove to Make Valid Parentheses
Data Structures & Algorithms

I was also asked 'Minimum Remove to Make Valid Parentheses' in the second coding round.

Q7
Design Facebook Status Search
System Design

I was tasked with designing the Facebook Status Search system in the system design round. I used an iPad to explain and draw the architecture diagram.

Q8
First Bad Version (or similar)
Data Structures & Algorithms

During the behavior round, I also encountered a coding question which was similar to 'First Bad Version'.

Facebook | E4 | London
facebook logo
Facebook
iOS EngineerLondon5 yearsOngoing
November 1, 202023 reads

Summary

I recently completed my onsite interview for an iOS Engineer role at Facebook in London. The interview included coding, behavioral, and a system design round where I had to design a messenger app. I believe my performance was strong and I'm currently awaiting the outcome, hoping for an E5 offer.

Full Experience

I recently completed my onsite interview for an iOS Engineer position at Facebook in London. I have 5 years of experience (YOE).

In the first coding round, I tackled two standard questions, though not from LeetCode. I performed well, successfully running tests for the first question, and even though I couldn't run tests for the second due to time constraints, the interviewer seemed fine with it.

The second coding round presented one medium and one hard question, both of which I was able to solve in O(n) time complexity. This round also went smoothly.

The behavioral round involved standard questions about challenging work and my motivation for joining Facebook. I effectively answered these by sharing past examples from my career.

The fourth round, iOS System Design, was particularly engaging. My task was to design a messenger app. I felt this round went great, as I was able to discuss multiple architectural approaches for each component, along with their respective tradeoffs and scalability considerations.

My pre-screening took place in March, but the onsite interview was scheduled for October due to a hiring freeze for E4 positions. Overall, I feel my rounds went well, and I'm optimistic about potentially receiving an E5 offer. I'm now waiting for an update regarding the hiring freeze and my candidacy.

Interview Questions (1)

Q1
Design Messenger App
System Design

My task was to design a messenger application. During the discussion, I explored and discussed multiple architectural approaches for various components, emphasizing their tradeoffs and scalability implications.

Facebook interview experiences - All Combined from LC - Till Date 07-Jun-2020
facebook logo
Facebook
June 7, 202026 reads

Summary

This is a comprehensive collection of interview experiences at Facebook, compiled from various LeetCode posts up to June 7, 2020. It covers questions encountered in Phone Screens, Coding Rounds, Design discussions, and Behavioral interviews, offering insights into the breadth of topics tested.

Full Experience

I've gathered a wide array of questions encountered by candidates interviewing at Facebook, organized by interview rounds. The compilation includes numerous Data Structures & Algorithms problems, often linked directly to LeetCode, as well as custom problem statements. System Design questions cover a range of topics from debugging server issues to designing scalable services like Google Search, Instagram, or file storage systems. Behavioral questions delve into common scenarios, personal experiences, and career aspirations. This collection aims to provide a broad overview of the types of challenges faced in Facebook interviews.

Interview Questions (94)

Q1
Find All Anagrams in a String
Data Structures & Algorithms
Q2
Shortest Bridge
Data Structures & Algorithms
Q3
Partition Equal Subset Sum
Data Structures & Algorithms
Q4
Valid Palindrome II
Data Structures & Algorithms
Q5
Kth Smallest Element in a BST
Data Structures & Algorithms
Q6
Generate K Random Mines on Grid
Data Structures & Algorithms

You are given a mn grid. You are asked to generate k mines on this grid randomly. Each cell should have equal probability of k / mn of being chosen. Your algorithm should run in O(m) time.

Q7
Continuous Subarray Sum
Data Structures & Algorithms

Given a list of positive numbers and a target integer k, write a function to check if the array has a continuous subarray which sums to k.

Q8
Verifying an Alien Dictionary
Data Structures & Algorithms
Q9
Alien Dictionary
Data Structures & Algorithms
Q10
Course Schedule
Data Structures & Algorithms
Q11
Interval List Intersections
Data Structures & Algorithms
Q12
Minimum Remove to Make Valid Parentheses
Data Structures & Algorithms
Q13
Plus One
Data Structures & Algorithms
Q14
Range Sum of BST
Data Structures & Algorithms
Q15
Check for Two-Swap Similar Strings
Data Structures & Algorithms

Given two strings, return true if they are similar, meaning only 2 positions in the strings are swapped (e.g., 'face', 'eacf' -> true because 'f' and 'e' are swapped).

Q16
Number of Connected Components in an Undirected Graph
Data Structures & Algorithms
Q17
Add Binary
Data Structures & Algorithms
Q18
Merge Two BSTs Inorder
Data Structures & Algorithms

Given two binary search trees, merge everything so it prints inorder.

Q19
Valid Palindrome
Data Structures & Algorithms
Q20
Add Strings
Data Structures & Algorithms
Q21
Serialize and Deserialize Binary Tree
Data Structures & Algorithms
Q22
Lowest Common Ancestor of a Binary Tree
Data Structures & Algorithms
Q23
Smallest Subtree with all the Deepest Nodes
Data Structures & Algorithms
Q24
Binary Tree Paths
Data Structures & Algorithms
Q25
Minimum Window Substring
Data Structures & Algorithms
Q26
Maximum Subarray
Data Structures & Algorithms
Q27
Valid Parentheses
Data Structures & Algorithms
Q28
Merge Intervals
Data Structures & Algorithms
Q29
Task Scheduler
Data Structures & Algorithms
Q30
Clone Graph
Data Structures & Algorithms
Q31
Insert Interval
Data Structures & Algorithms
Q32
Convert a Number to Hexadecimal
Data Structures & Algorithms
Q33
Rotate Array
Data Structures & Algorithms
Q34
K Closest Points to Origin
Data Structures & Algorithms
Q35
Find All Paths Sum to Target in a Binary Tree (Discussion)
Data Structures & Algorithms
Q36
Product of Array Except Self
Data Structures & Algorithms
Q37
Closest Binary Search Tree Value
Data Structures & Algorithms
Q38
Insert Delete GetRandom O(1)
Data Structures & Algorithms
Q39
Fraction to Recurring Decimal
Data Structures & Algorithms
Q40
Pow(x, n)
Data Structures & Algorithms
Q41
Subarray Sum Equals K
Data Structures & Algorithms
Q42
Best Time to Buy and Sell Stock
Data Structures & Algorithms
Q43
Best Time to Buy and Sell Stock III
Data Structures & Algorithms
Q44
Best Time to Buy and Sell Stock IV
Data Structures & Algorithms
Q45
Add and Search Word - Data Structure Design
Data Structures & Algorithms
Q46
Sudoku Solver
Data Structures & Algorithms
Q47
Schedule of Tasks (Discussion)
Data Structures & Algorithms
Q48
Binary Tree Maximum Path Sum
Data Structures & Algorithms
Q49
Move Zeroes
Data Structures & Algorithms
Q50
Valid Number
Data Structures & Algorithms
Q51
First Bad Version
Data Structures & Algorithms
Q52
Shortest Path with API Only
Data Structures & Algorithms

You have an API to check if it's possible to move left, right, up, down and one more method to check if current position is the last one. Find the shortest way to the last position. You don't have any data structure - only API.

Q53
Group Shifted Strings
Data Structures & Algorithms
Q54
Calculate Tax from Brackets
Data Structures & Algorithms

Calculate tax if Salary and Tax Brackets are given as a list in the form [ [10000, 0.3],[20000, 0.2], [30000, 0.1], [null, .1]], where null represents the rest of the salary.

Q55
Path in Matrix from (0,0) to (m-1,n-1)
Data Structures & Algorithms

Is there a way to reach (0,0) from a mXn matrix to (m-1,n-1) position and give the path.

Q56
Simplify Path
Data Structures & Algorithms
Q57
N-ary Tree True Flag Distance
Data Structures & Algorithms

N-ary Tree with each node having a boolean flag. Traverse all the nodes with only boolean flag = True. Return the total distance traveled from root to all those nodes.

Q58
Is Graph Bipartite?
Data Structures & Algorithms
Q59
Merge Sorted Array
Data Structures & Algorithms
Q60
Remove Invalid Parentheses
Data Structures & Algorithms
Q61
Binary Tree Level Order Traversal
Data Structures & Algorithms
Q62
Longest Increasing Path in a Matrix
Data Structures & Algorithms
Q63
Custom Sort String
Data Structures & Algorithms
Q64
Read N Characters Given Read4
Data Structures & Algorithms
Q65
Palindrome Permutation
Data Structures & Algorithms
Q66
Max Consecutive Ones III
Data Structures & Algorithms
Q67
Exclusive Time of Functions
Data Structures & Algorithms
Q68
Search in Rotated Sorted Array
Data Structures & Algorithms
Q69
Search in Rotated Sorted Array II
Data Structures & Algorithms
Q70
Design Google Search
System Design
Q71
Debug Remote Server Not Responding
System Design

A remote server is not responding. Debug the issue, covering the entire TCP/IP stack (fragmentation, ICMP, etc.), machine metrics (vmstat, iostat, strace etc.), and describe virtual memory in terms of demand paging.

Q72
Debug Slow Responding Machine
System Design

Two machines are connected, suddenly one machine is responding slowly. Identify potential causes (NFS, Networking, Kernel resources like buffer-cache, inodes, virtual memory) and discuss diagnostic commands (strace, lsof, readlink, cat /proc/pid etc).

Q73
Design Resource Copy N Sources to M Sinks
System Design

Design a system to copy resources from N sources (N < 10) to M sinks (M could be 10k/Millions etc.).

Q74
Design File Storage System (Dropbox/Google Drive)
System Design
Q75
Design Scheduling Service
System Design

Design a scheduling service, focusing on a SQL approach. Discuss concurrency issues, table schemas, and composite keys.

Q76
Design Instagram Celebrity Recommendation
System Design
Q77
Design Twitter Search
System Design
Q78
Design Content Publishing Site with Privacy
System Design
Q79
Design Uber
System Design
Q80
Design Type-Ahead Feature
System Design

Design a type-ahead feature for a website, discussing various data structures, their advantages/disadvantages, and different cases/scenarios.

Q81
Design Instagram Client-Side
System Design
Q82
Design LeetCode Contest & Leaderboard System
System Design
Q83
Design Instagram
System Design
Q84
Design Keyword Search in FB Posts
System Design
Q85
Design Top 10 Songs per User Service
System Design

Design a service for music providers (like Spotify, Apple Music) to display the top 10 songs played by each user. Includes designing ER tables and APIs.

Q86
Design HackerRank-like Programming Contest System
System Design
Q87
Describe Your Current Role
Behavioral
Q88
Describe a Project You Are Proud Of
Behavioral
Q89
Giving Difficult Feedback
Behavioral

Tell me about a time when you had to give someone difficult feedback. How did you handle it? What kind of feedback did you give?

Q90
Conflict with Manager
Behavioral

Tell me about a time when you had a conflict with a manager and how you resolved it.

Q91
Most Difficult Problem Solved
Behavioral
Q92
Ideal Work Environment
Behavioral

Which environment is best to you to work ?

Q93
Best Life Decision from Childhood
Behavioral

Tell about best decision in your life from childhood ? Decision that changed your life

Q94
Areas for Improvement
Behavioral

On which topics you want improve? What are doing to impoving on that topics ? Did you try build project on that topics ?

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.