For example, input like this
["PhoneDirectory","get","check","get","get","release","check","get","get","get"] [,, ,,,,,,,]
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?
@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.
Just like you buy a cellphone number, you will get a number which is available but normally not the "smallest" one.
Thanks for your explanation.
Now I am curious how the leetcode OJ system verifies the output, if there is no unique answer.
@Tiejun In my opinion, this can be done by verifying if the outputs of your program are located within the expected number span.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.