Find the missing array member in an unsorted integer array


  • 0
    F

    Given an unsorted integer array containing sequential values starting from 1 find the missing value. There is guaranteed to be only one missing value and the array is not sorted.

    Strive to solve in O(n) with O(1) space.

    for the array [1,2,3,5] the answer would be 4.


  • 0

    What do you mean by containing values starting from 1? For an array of size 3, is this array valid: [1, 10, 10]?


  • 0
    F

    Sorry, left out the word "sequential". corrected. thank you.


  • 0

    The example does not contain duplicate value but the problem description mentions it is guaranteed to be only one duplicate value. Could you please check?


  • 0
    F

    fixed. there is a separate question with dupe scenario. comments got mixed.


  • 0

    I believe this is the same question as Missing Number.


Log in to reply
 

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