Error in test case?


  • 2

    I got "Submission Result: Wrong Answer" due to following test case,
    can anybody explain the expected behavior?
    Input:
    [1,1,2,2,3,3]
    2
    Output:
    [1,2]
    Expected:
    [1,3]


  • 0
    L

    Seems more test cases were added and corners cases were not fully covered.


  • 0
    S

    This output may likely come when we store the count of the numbers in a heap. So the heap may look like this [1,2,3] . So when the first max element is removed , 1 is removed and then heap looks like [3,2,1] then max is removed , 3 is removed. Hence the output. Testcases should accept multiple possible outputs.


  • 0

    @shilpa6 I think that makes sense. nice notice


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.