Bloomberg Interview Question

given an integer input stream, and more and more integers are still going in. build an algorithm to return 3 minimum integers at any point of time.

Interview Answers

Anonymous

Nov 29, 2015

As far as I can see, if the integers are never removed, just keep the array of the 3 minimum ints and for each input adjust appropriately. The min will never go back up if nothing is ever removed.

2

Anonymous

Nov 5, 2015

Priority queue (heap) should work

1

Anonymous

Oct 27, 2015

Use BST to store incoming integers.