I think, this condition is buggy.
if (this.minHeap.length > this.k) {
this.minHeap.pop();
}
if number is less than minHeap.peek() we are not going to get the kth largest in that case, right?
I think, this condition is buggy.
if (this.minHeap.length > this.k) {
this.minHeap.pop();
}
if number is less than minHeap.peek() we are not going to get the kth largest in that case, right?
Will look into the solution. There are a few issues with the solution provided.