Facebook | Phone screen | Merge K Sorted Arrays
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2019-06-27Added By Anonymous
Source: Link
Company: Meta (Facebook)
Role: unknown
Interview Stage: Phone screen
Location: unknown
Year: unknown
Original Post Content:
Given k sorted integer arrays, merge them into one sorted array.
Example 1:
Input:
[[1, 3, 5, 7],
[2, 4, 6],
[0, 8, 9, 10, 11]]
Output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Example 2:
Input: [[1, 2, 3], [1, 2]]
Output: [1, 1, 2, 2, 3]
Although the algorithm was easy to solve. The interviewer drilled me more on runtime complexities.
Why Heap
What other approaches
etc