Median in a stream of running integers


https://hack.codingblocks.com/practice/p/378/1274

on Compile-> it is giving correnct output
on Submit->it is Showing wrong-answer.

Please Check.

if d>median u r pushing in minheap and if d>median u r pushing in maxheap but what if d=median u are not taking that case
make it like this
else if(d>median)
{
//Add to minHeap
minHeap.push(d);
median2();
return;
}
else
{
//Add to maxHeap
maxHeap.push(d);
median2();
return;
}

1 Like

It works perfect.
Thank you Bhaiya.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.