FaceBook Phone Screen(Menlo Park 5YOE)

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-08-12Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e4, e5
Interview Stage: Phone Screen
Location: Menlo Park
Year: unknown

Original Post Content:

Hi, I was asked two questions in my Facebook Phone Screen yesterday.
1st: was variation of
609. Find Duplicate File in System (VERY close to this though)
2nd was this:

Given k sorted segments of an array, sort the array
for example:

9,10,11,2,3,4,-1,0,1
sort this:
-1,0,1,2,3,4,9,10,11

I created a list of lists. I tried to extract elements from these k segments in k lists. Then created a Priority queue of size k and in every iteration, only put k elements in the queue. Since this will be min queue, my root will have the minimum element. I will reuse the same array (provided in input) and poll from queue to my array back.

Can someone come up with anything else?

My code did not work completely, but the interviewer seemed satisfied.

Waiting for results.

Thanks and hope this helps

Comments