Bloomberg interview question

Print the top 10 largest elements from integer array. Follow up to top K

Interview Answer

Anonymous

13 Nov 2018

Make a heap of negative of all the elements. Then heappop() K times. Complexity K*log(n)