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.
What do you mean by
containing values starting from 1? For an array of size 3, is this array valid:
[1, 10, 10]?
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?
I believe this is the same question as Missing Number.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.