getting wrong asnwer while submitting
Getting wrong answer
Hello @piyush.bansal8158625,
Your Code is failing for the test case like:
-
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. -
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.