I am trying to understand the bar at Facebook for a new grad role. I was able to explain and code the optimal solution within 20 minutes in the phone screen round and was then able to explain the logic of the follow-up question. I also did a dry run for a test case and explained the time and space complexities. Still got rejected. What do the interviewers expect in general?
Ye it depends on the complexity of the questions. Generally (a leetcode hard and medium ) or two leetcode medium with multiple approach. they expect to implement fully. Hope this helps
That is tough yo do in 45m -1hr
Yes I had got two leetcode medium. For each question they asked for multiple approach. If you miss one or two things while coding that's fine
Ye ye they are looking for a coding ninja
May be it is your voice. It should be a sexy, husky baritone.
OP please try it next time .you ll crack it for sure
Will try!
Try for Uber 😀
Normally two questions
2 yrs back I got linked list reverse alternative k nodes. I have finished coding in colabedit with code for testing in 10 mins. While running output Is NOT Correct at the End Of list. I spent next 30 mins for debugging without success. I thought it is reject but called for onsite. Failed onsite for system design as I don't have experience in large scale. In the same month I had google phone interview. Got get k smallest elments from large stream of integers with twist that k smallest elements sorted p Based on position in the original input. I have used c++ map for storing k smallest elments along with position. After processing input I have sorted again with map based on index. O (n log k) solution. I tested code after interview using vc++ and found working well but got rejected Neve know.
I'm curious, if using a map - how do you insert the smallest element into it? And, how do you keep track of k smallest? Isn't heap a better choice for this?
Heap or priorityqueue is best to use here...
Map last element is the largest. If greater than don't insert. If less than that insert and delete last item
Umm. Isn't map unordered? How did you find the last element and how are maintaining the last element to be the largest?
C++ has map and unordered_map
I should have used priority q though.
Yeah. This would be have been an easier choice to implement the solution and probably the best data struct for such a problem too.
They generally do 2/3 exercises in the phone screen