The test case is wrong or I am?


  • 1

    For example, input like this ["PhoneDirectory","get","check","get","get","release","check","get","get","get"] [[5],[], [1],[],[],[1],[2],[],[],[]]

    I think the right output should be [null,0,true,1,2,null,false,1,3,4], but instead I was told the expected result is [null,0,true,1,2,null,false,3,1,4]. Does it make sense? Since 1 is released, get operation should return the minimum available number, am I correct?


  • 0

    @Tiejun No, get operation can return any available number. The expected output is for your reference only. For this question, there's no unique output. As long as your output satisfies the problem's constraint, your solution will be judged as correct.


  • 0

    @Tiejun
    Just like you buy a cellphone number, you will get a number which is available but normally not the "smallest" one.


  • 0

    @1337c0d3r , @Nakanu ,

    Thanks for your explanation.

    Now I am curious how the leetcode OJ system verifies the output, if there is no unique answer.


  • 0
    Y

    @Tiejun In my opinion, this can be done by verifying if the outputs of your program are located within the expected number span.


Log in to reply
 

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