Incomplete question - needs and additional constraint


  • 0
    Y

    The time complexity is mentioned as O(log n). To meet this, an additional constraint needs to be added in the question: "All repeated numbers appear in pairs in the input." The examples in the question seem to illustrate this, but the condition is not mentioned in the question itself.

    PS: I received this question in a real interview too, and that is how I am aware.


  • 1

    The problem is fine. How could they not appear in pairs?


  • 0
    R

    The sorted array constraint implies that same numbers will occur in pair. I also mentioned explicitly that only two such numbers occur in all cases (except for the element which we want to find)


  • 0
    Y

    I think I overlooked "sorted". Sorry about that!


Log in to reply
 

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