Pergunta de entrevista da empresa Google

1st interview question - How can you merge k sorted data streams using O(1) RAM? Also, explain in detail how will you define the data stream object and its related functions/operations. 2nd interview questions - 1. Write a code that accepts integers as arrays and outputs the multiplication result as an array. 2. Write a code that takes the coordinates of multiple rectangles as input and returns as output the coordinates of the rectangle that is the intersection of all the rectangles.

Respostas da entrevista

Sigiloso

13 de ago. de 2013

You would have find the smallest among the head of each stream and process that/pop that into the output array. You would then update the head of the stream from where you removed the smallest number and bring the next element in the stream to the head. You could implement the streams using linked lists.

1

Sigiloso

27 de fev. de 2014

k-way merge sort, the only difference being, you directly start from merging