I had my Facebook phone technical interview for SE internship .. 2 phone interviews back to back
Interview 1:
https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/
I think I did a bit of complex code [like the leetcode hard question to return all possible values] (he asked about the complexity I told him its O(n square) I'm not 100% sure of that) but he asked if I can write another one with less complexity I suggested a solution he told me he think its fine but didn't ask me to code it.
Interview 2:
She told me she will ask 2 question, right after she asked the first question the phone signal went off so she told me to start coding on coderpad until she tries to recall me so I started coding (ofocurse she could see my code) then after multiple attempts of restarting the phone and so on I suggested that we call on coderpad and it worked but we had only 15 mins left in the interview, I told her that I can finish the question she asked, I did finish it I think I did well on it. but at then end she told me that most probably we will reschedule because she wanted to ask another question .
The Questions was: given an array [1, 4, 0 ,2,5] return True if a^2+b^2=c^2 exisit in the array. Quite similar to 3-sum approach I solved it in O(n^2)
The recruiter then sent me an email asking for another time for the interview instead of the one with the phone signal trouble, I was wondering do you think they will take into consideration that I solved the problem in the 2nd interview ? or will the 2nd interview be completely discarded ?
I am really bumped about that since my rescheduled one was difficult I dont think I will pass
Interview 3 (rescheduled):
https://leetcode.com/problems/print-immutable-linked-list-in-reverse/ (premium)
I told the interviewer how I will approach it recursively and told him it will done in O(n) time and O(n) space due to recursion while keeping the list the same as it is.
he told me he want in O(1) space, I told him ok I can reverse the link list itself in O(N) time and O(1) space he told me to code it and I did then he told me "I don't want to reverse it " "I just want to print it in reverse" with constraint O(1) space
so I suggested a brute force solution:
traverse the list get the size and print last element
traverse again till size-1 and print last element and so on, he asked about the complexity sadly I got it wrong O(n!) which I later corrected to O(n2) but he told me he wants a better time.
Then later I suggested to divide the list, he asked divide it how but I didn't know so he walked me through dividing it by 2
if L=100, divide by 2 space O(2) time (50 ^ 2 * 2)
if L=100 divide by 5 space O(5) timeO( 20 ^ 2 * 5)
if L=100 divide by K space O(K) timeO( N/K ^ 2* K)
he then asked about the best value of K which he later told me its square root N
so if I divide the list into sqrt(N) lists. I am really disappointed I prepared really hard and what's disappointing that on the other interview phone trouble I was able to solve optimally the 1st question (which I think that the whole interview will be discarded )
update: sadly i didnt make it