📌 Facebook | E5 | Bay Area | Phone Screen
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) -> (a[0] - b[0])); List<int[]> result = new ArrayList<>(); int start = intervals[0][0]; int end = intervals[0][1]; for (int i = 1; i < intervals.length; i++) { if (intervals[i][0] <= 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)
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.