Facebook | Phone | Merge 2 Sorted Lists & Max Path Sum
Anonymous User
1784

Location: London
Position: E4/E5 at Facebook

My Background:
SDE in Amazon for ~3 years.
Total experience ~ 5 years.

Facebook recruiter reached out to me via linkedin for E4/E5 SWE in April 2020. I requested some time for preparation and schduled the phone-screen interview for May 2020.

Interview Questions & Experience

Interviewer initially introduced himself and then asked to open their coding platform link (coderpad).

Question 1:
Merge two sorted linked list

Input:
1->2->3->4->5
3->5

Output:
1->2->3->3->4->5->5

I provided the approach on merging and provided time complexity of 0(n+m) where n = size of 1st LL, m = size of 2nd LL. Interviewer seemed okay with the response and asked me to code it.

As there was no function definition (unlike what we have in LC), I provided the function definition before coding. Finished up coding in 10 mins and dry-run it for some happy case and edge-cases.

Interviewer asked to write test inputs against which I had dry-run the code. Interviewer seemed okay with the code.


Question 2:
The interviewer gave a very vague question saying "Find max path sum in Binary Tree"

Input:
    1
   / \
  2  3
    /  \
   4   5
   
Output: 12 [3,4,5]

I got the idea that interviewer is asking this specific question -> https://leetcode.com/problems/binary-tree-maximum-path-sum/ and hence asked some clarifying questions to understand the problem statement correctly.

Provided the solution using modified DFS approach, interviewer seemed okay with solution. Asked me to code it.

As there was no function definition (unlike what we have in LC), I did explain the function def. again. It took me some time in coding the 2nd question, while I just completed coding and was dry-running the code, interviewer stated we are running out of time. It was 40 mins till that point of time.

Interviewer asked whether I have any questions at the end for which he reserved 5 mins.

I was not sure whether i would be able to clear phonescreen given i could not solve 2nd question completely; but recruiter reached out 2 days later to schedule onsite virtual interviews.

Comments (5)