Getting wrong answer


getting wrong asnwer while submitting

Hello @piyush.bansal8158625,

Your Code is failing for the test case like:

  1. 2
    5 2
    5 1 3 5 2
    5 2
    5 1 3 5 2
    ExpectedOutput:
    5 1 5 1 3 5 1 5 1
    5 1 5 1 3 5 1 5 1
    Your Output:
    5 1 5 1 3 5 1 5 1
    5 5 1 5 1 5 5 5 5
    Reason:
    Clear data of map after each test case i.e. the frequencies of each element.

  2. 1
    5 3
    5 1 1 5 2
    Expected Output:
    5 1 5 1 5 1 5 1 5 2
    Your Output:
    5 1 5 1 1 5 1 5 1 1 5 1
    Reason:
    You are just pushing elements into the heap irrespective of it’s previous presence in the heap.

Hope, this would help.
Give a like if you are satisfied.