Median in a stream of running integers problem

I am getting correct output for the sample test case but my code if failing to get submitted. Please help.

Hey friend, I saw your code, and one reason why you won’t get expected output is because you are checking if leftheap.size()> rightheap.size() instead you have to check when the iteration between them will be of 2 units. You got the concept right which I can see from your code, but you are implementing it in a right manner. Take this code for reference https://ide.codingblocks.com/s/342971
Try to implement like this :slight_smile:

Sir, I am getting a TLE in one of the test cases when I am using your code

Okay I’ll check and let you know.

hey friend please check it at your end as when i have submitted this code i got all test cases passed. You can see


This is what I am getting

Might be some issue on online compiler. Try to submit it Tomorrow . If it still doesn’t get accepted then let me know :slight_smile:
I’ll report it to support.

@rahul.gupta03111999
add fast io and then try