Whatnot Interview Question

Maintain the k smallest values in an arbitrarily long data stream.

Interview Answer

Anonymous

Nov 2, 2022

Use a max-heap to compare the kth largest element with every new element u wish to add to your heap.