Medallia Interview Question

sum of k smallest number

Interview Answers

Anonymous

Jun 24, 2015

You could: a) Heapify the list and ask for the first k numbers: O(k logn). b) Find the k-th statistic X and then iterate through the list adding only the numbers less than X: O(n) (difficult) or expected O(n) (it's just a tweaking of quicksort)

1

Anonymous

Feb 7, 2013

hello , was the online test a codility.com test ? .

Anonymous

Feb 7, 2013

can be done in O(n)