Top K most frequent number in a stream

Please tell me what’s wrong in the code. There is only one test case but it’s showing wrong answer.

You are not emptying the heap after each test case.
Cross verify with this

Got it, well I didn’t think that way :sweat_smile: .Thank you so much for sharing the code :slightly_smiling_face: